# Numerical and Data libraries
import os
import csv
import json
import numpy as np
import numpy.polynomial as Poly
import pandas as pd
from random import random, gauss, shuffle
from math import pi,exp,log,sqrt,gamma,floor,ceil
import cmath
import time
import datetime
import itertools
from itertools import islice
from collections import Counter
import warnings
# Time Series libraries
from statsmodels.graphics.tsaplots import acf, plot_acf, plot_pacf
import statsmodels.api as sm
#from statsmodels.tsa import arma_generate_sample
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.arima_model import ARIMA
import scipy as sp
from scipy import signal
from scipy.fft import fft, fftshift
from scipy.stats import truncnorm, halfnorm, invgamma
import scipy.stats as stats
# Plotting libraries
from IPython.display import display, Math, Image, HTML, Markdown
import tables
import tabulate
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.ticker as mticker
from matplotlib.colors import ListedColormap
import matplotlib.cm as cm
import pylab
import seaborn as sns
%matplotlib inline
plt.rcParams['figure.figsize'] = (12, 8)
plt.rcParams['figure.dpi'] = 300
# define ranndom number generator with specific seed for certain
# reproducible results (do not define seed globally)
rng = np.random.RandomState(2022)
# call this as e.g. rng.random(4) = array([0.75694783, 0.94138187, 0.59246304, 0.31884171])
# to display latex table
#display(HTML("<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/"
#"latest.js?config=default'></script>"))
#np.random.seed(1)
US_Electricity_Data = pd.read_csv("~/Desktop/M4R/M4R Data/US Electricity Data/US_Electricity_Data.csv")
time_elec_sales_monthly = US_Electricity_Data.loc[:,'time']
x_elec_sales_monthly = US_Electricity_Data.loc[:,'all']
elec_hourly_Feb21 = pd.read_csv("~/Desktop/M4R/M4R Data/Hourly US48 Electricity Demand/elec_hourly_Feb21.csv")
time_elec_hourly_Feb21 = elec_hourly_Feb21.loc[:,'Timestamp (Hour Ending)']
x_elec_hourly_Feb21 = elec_hourly_Feb21.loc[:,'Demand (MWh)']
# Not Seasonally Adjusted
US_CPI_Data = pd.read_csv("~/Desktop/M4R/M4R Data/US CPI Data/US_CPI.csv")
US_CPI_Data = US_CPI_Data[28:] # May 1982-Apr 2022 (480 entries)
time_cpi = US_CPI_Data.loc[:,'time']
x_cpi = US_CPI_Data.loc[:,'MoM']
# Seasonally-Adjusted
US_CPI_Data_SA = pd.read_csv("~/Desktop/M4R/M4R Data/US CPI Data/US_CPI_SA.csv")
US_CPI_Data_SA = US_CPI_Data_SA[28:] # May 1982-Apr 2022 (480 entries)
time_cpi_sa = US_CPI_Data_SA.loc[:,'time']
x_cpi_sa = US_CPI_Data_SA.loc[:,'MoM']
# R built-in datasets
common_filepath = '/Users/mateipapahagi/Desktop/M4R/M4R Data/R Datasets/'
# Monthly Electricity Production
Monthly_Electricity_Production = pd.read_csv(common_filepath+'Monthly_Electricity_Production.csv')
time_prod_monthly = Monthly_Electricity_Production.iloc[:,0]
x_prod_monthly = Monthly_Electricity_Production.iloc[:,1]
# Half-Hourly Electricity Production
Half_Hourly_Electricity_Data = pd.read_csv(common_filepath+'Half_Hourly_Electricity_Data(Taylor).csv')
time_elec_half_hourly = Half_Hourly_Electricity_Data.iloc[:,0]
x_elec_half_hourly = Half_Hourly_Electricity_Data.iloc[:,1]
# UK Retail Sales
UK_Retail_Data = pd.read_csv(common_filepath+'UK_Retail_Data.csv')
time_retail_sales = UK_Retail_Data.iloc[:,0]
x_retail_sales = UK_Retail_Data.iloc[:,1]
Google_Trends_Holiday_Data = pd.read_csv("~/Desktop/M4R/M4R Data/Google Trends Data/google_trends_holiday_uk_weekly.csv")
time_holiday = Google_Trends_Holiday_Data.iloc[:,0]
x_holiday = Google_Trends_Holiday_Data.iloc[:,1]
# Simulated Datasets (see Section 6)
sim_filepath = '/Users/mateipapahagi/Desktop/M4R/M4R Data/Simulated Data/'
# ARMA(3,3) with complex and real roots
x_arma_1111 = pd.read_csv(sim_filepath + 'ARMA_1111_500.csv',header=None).iloc[:,0]
arma_1111_model = pd.read_csv(sim_filepath + 'ARMA_1111_coef',header=None)
S_arma_1111 = pd.read_csv(sim_filepath + 'ARMA_1111_sdf.csv',header=None).values.flatten()
param_true_arma_1111 = json.loads(arma_1111_model.iloc[-1,-1])
# 1-factor Gegenbauer process
x_gegenbauer_1 = pd.read_csv(sim_filepath + 'Gegenbauer_1_500.csv',header=None).iloc[:,0]
gegenbauer_1_model = pd.read_csv(sim_filepath + 'Gegenbauer_1_coef',header=None)
S_gegenbauer_1 = pd.read_csv(sim_filepath + 'Gegenbauer_1_sdf.csv',header=None).values.flatten()
param_true_gegenbauer_1 = json.loads(gegenbauer_1_model.iloc[-1,-1])
# GARMA(5,1,3) process
x_garma_12111 = pd.read_csv(sim_filepath + 'GARMA_12111_500.csv',header=None).iloc[:,0]
garma_12111_model = pd.read_csv(sim_filepath + 'GARMA_12111_coef',header=None)
S_garma_12111 = pd.read_csv(sim_filepath + 'GARMA_12111_sdf.csv',header=None).values.flatten()
param_true_garma_12111 = json.loads(garma_12111_model.iloc[-1,-1])
# GARMA(3,2,2) process
x_garma_11012 = pd.read_csv(sim_filepath + 'GARMA_11012_500.csv',header=None).iloc[:,0]
garma_11012_model = pd.read_csv(sim_filepath + 'GARMA_11012_coef',header=None)
S_garma_11012 = pd.read_csv(sim_filepath + 'GARMA_11012_sdf.csv',header=None).values.flatten()
param_true_garma_11012 = json.loads(garma_11012_model.iloc[-1,-1])
# plot all datasets
time_series_list = [x_elec_sales_monthly,x_elec_hourly_Feb21,x_prod_monthly,x_elec_half_hourly,x_retail_sales,x_cpi,x_holiday,x_arma_1111,x_gegenbauer_1,x_garma_12111,x_garma_11012]
time_series_names = ['Monthly Electricity Retail Sales','Hourly Electricity Demand (Feb 2021)',
'Monthly Electricity Production','Half-Hourly Electricity Consumption','UK Retail Sales','US MoM CPI',
'Google Trends Searches for "Holiday"','Simulated ARMA(3,3) Process','Simulated 1-Factor Gegenbauer Process','Simulated GARMA(5,1,3) Process','Simulated GARMA(3,2,2) Process']
n_time_series = len(time_series_list)
fig = plt.figure(figsize=(12,12))
i=0
for n in range(n_time_series):
i+=1
ax = fig.add_subplot(ceil(n_time_series/2),2,i)
ax.plot(time_series_list[n],color='black')
plt.title(time_series_names[n])
plt.xlabel('Time')
plt.ylabel('Value')
plt.grid()
plt.tight_layout()
pylab.show()
# min-max normalise a time series
def normalise(ts,as_list=False):
ts = np.array(ts)
min, max = np.min(ts), np.max(ts)
ts = (ts - min)/(max - min)
if as_list==True: return list(ts)
return ts
# subtract mean to make zero-mean
def demean(ts,as_list=False):
ts = np.array(ts)
mean = np.mean(ts)
ts = ts - mean
if as_list==True: return list(ts)
return ts
# mean-variance standardise a time series (not recommended,
# as we are not estimating the variance)
def standardise(ts,as_list=False):
ts = np.array(ts)
mean, std = np.mean(ts), np.std(ts)
ts = (ts - mean)/std
if as_list==True: return list(ts)
return ts
# Box-Cox transformation with automatic lambda detection
# for normalising the variance across the data for heteroskedastic time series
def box_cox(ts,as_list=False):
ts = np.array(ts)
ts = stats.boxcox(ts)[0]
if as_list==True: return list(ts)
return ts
# general pre-processing pipeline
def pre_process_ts(ts,normal=True,zeromean=False,standard=False,boxcox=False,n_differences=0,as_list=False,force_even=True):
ts = np.array(ts)
# first do box-cox for heteroskedastic data
if boxcox == True:
ts = box_cox(ts)
# then difference
if n_differences > 0:
for _ in range(n_differences):
ts = pd.Series(ts)
ts = ts.diff().dropna()
ts = np.array(ts)
# then either normalise, demean, or standardise
if normal == True:
ts = normalise(ts)
if zeromean == True:
ts = demean(ts)
if standard == True: # avoid using this when estimating the std
ts = standardise(ts)
# eliminate the last value if the time series has odd length
if force_even == True and len(ts)%2==1:
ts = ts[:-1]
if as_list: return list(ts)
return ts
def multi_ts_plot(ts1,*args):
# plot (up to 2 at the moment) time series and their periodograms
assert len(args) <= 1
fig, (ax1,ax2) = plt.subplots(nrows=1, ncols=2, figsize=(15, 6))
color_vals = ['red','blue']
label_vals = ['Original / Simulated TS','Estimated TS']
# time series plot
ax1.plot(ts1,alpha=0.5,color=color_vals[0])
if len(args)>0: ax1.plot(args[0],alpha=0.5,color=color_vals[1])
# periodogram plot
f1,Z1 = signal.periodogram(ts1,window='boxcar',scaling='spectrum')
ax2.bar(f1,Z1,width=0.003,color=color_vals[0],alpha=0.5)
if len(args)>0:
f2,Z2 = signal.periodogram(args[0],window='boxcar',scaling='spectrum')
ax2.bar(f2,Z2,width=0.003,color=color_vals[1],alpha=0.5)
ax1.set_title('Time Series',fontsize=16)
ax2.set_title('Periodogram',fontsize=16)
col_legends = [mpatches.Patch(color=color_vals[i], label=label_vals[i]) for i in range(2)]
if len(args)>0:
ax1.legend(handles = col_legends, prop={'size': 8})
ax2.legend(handles = col_legends, prop={'size': 8})
fig.tight_layout()
def ts_plot3(ts,n_lags=None,title=""):
# plot one time series, its periodogram, and its acf
if n_lags == None: n_lags = len(ts)//2
plt.figure(figsize=(12, 6))
# time series
ax1 = plt.subplot(2,2,1)
ax1.plot(ts)
# periodogram
ax2 = plt.subplot(2,2,2)
f,Z = signal.periodogram(ts,window='boxcar',scaling='density')
ax2.bar(f,Z,width=0.003)
# acf
ax3 = plt.subplot(2,1,2)
plot_acf(ts,lags=n_lags,ax=ax3,bartlett_confint=False,alpha=0.99)
plt.margins(x=0)
# titles and other configs
ax1.set_title('Time Series',fontsize=16)
ax1.set_xlabel('Time',fontsize=12)
ax2.set_title('Periodogram',fontsize=16)
ax2.set_xlabel('Frequency',fontsize=12)
ax3.set_title('Autocorrelation Sequence',fontsize=16)
ax3.set_xlabel('Lag',fontsize=12)
plt.suptitle(title, fontsize=20)
plt.tight_layout()
#plt.show()
# choose and pre-process the dataset
x = x_cpi #x_arma_1111 #x_cpi #x_elec_hourly_Feb21 #x_garma_11012
y = pre_process_ts(x,zeromean=True,normal=False,standard=False,n_differences=0) #y = pre_process_ts(x,normal=False,standard=True,n_differences=1)
print("mean: ",np.mean(y),'\n',"std dev: ",np.std(y))
ts_plot3(x_garma_11012,n_lags=50,title="")
mean: -7.401486830834377e-18 std dev: 0.3259201051339969
# Test for stationarity
stationarity_result = adfuller(y)
print('ADF Statistic: %f' % stationarity_result[0])
print('p-value: %f' % stationarity_result[1])
print('Critical Values:')
for key, value in stationarity_result[4].items():
print('\t%s: %.3f' % (key, value))
ADF Statistic: -3.981358 p-value: 0.001511 Critical Values: 1%: -3.444 5%: -2.868 10%: -2.570
# Function to calculate the Fourier frequencies and Periodogram
def S_p_vec(y,tapered=False,taper='hann',force_even=False,welch=False,spectrum_scale=False,as_list=False):
# Note: scaling == 'spectrum' divides the periodogram by 2*len(freqs)=2*(J+1) for scipy
if spectrum_scale == True: scale = 'spectrum' # use this to normalise the periodogram by the length of the TS
else: scale = 'density' # use this to have periodogram on the same scale as the SDF
# option to use Welch's method
if welch == True:
freqs, periodogram = signal.welch(y, return_onesided=True, noverlap=0, scaling=scale)
else:
if tapered == True: # apply a Hann taper (other options include: 'triang','hamming','exponential')
freqs, periodogram = signal.periodogram(y,window=taper,scaling=scale)
else:
freqs, periodogram = signal.periodogram(y,window='boxcar',scaling=scale) # otherwise use rectangular/boxcar window
# scale by the variance of the time series
# to bring SDF and periodogram on the same scale (very important)
periodogram = periodogram/np.var(y)
# option to make as list
if as_list == True: freqs, periodogram = list(freqs), list(periodogram)
# option to make of even length
if force_even == True and len(periodogram)%2 == 1:
return freqs[:-1], periodogram[:-1]
return freqs, periodogram
# MUST RUN
f, Z = S_p_vec(y,tapered=True,taper='hann')
#S_p_vec(y,tapered=False) #S_p_vec(y,tapered=True,taper='hann')
data = (f,Z)
plt.plot(f, Z,linewidth=2,color='gray')
#plt.bar(f,Z,width=0.003,color='gray')
plt.xlabel("Frequency",fontsize=16)
plt.ylabel("Tapered Periodogram",fontsize=16)
Text(0, 0.5, 'Tapered Periodogram')
## Function to compute complex conjugate AR and MA roots based on arguments and moduli
def xi_builder(alpha,omega):
# firstly, sort alpha and omega
alpha = np.sort(alpha)
omega = np.sort(omega)
# count the number of real roots (corresp to omega=0)
# and the number of complex roots (omega!=0)
R = sum(omega == 0)
C = sum(omega != 0)
# initialize xi
xi=np.zeros(R+2*C,dtype='complex_')
j = 0
if (len(omega)>0):
for i in range(len(omega)):
# real roots
if (omega[i] == 0):
xi[j] = alpha[i]
j = j+1
# complex conjugate roots
else:
xi[j] = alpha[i]*cmath.exp(2j*pi*omega[i])
xi[j+1] = alpha[i]*cmath.exp(-2j*pi*omega[i])
j = j+2
return(xi)
## Spectral density function (SDF)
def S_Y(f,alpha1,omega1,alpha2,omega2,Lambda,delta,sigma_epsilon,p,q,k):
# alpha1 and omega1 have length Rp+Cp
# alpha2 and omega2 have length Rq+Cq
# build the complex reciprocal roots
xi1 = xi_builder(alpha1,omega1) # has length p=Rp+2*Cp
xi2 = xi_builder(alpha2,omega2) # has length q=Rq+2*Cq
# MA component
if (q!=0):
MA_multiplicands = [1-xi2*cmath.exp(2j*pi*f) for xi2 in xi2]
MA_factor = np.prod(np.abs(MA_multiplicands)**2)
else: MA_factor = 1
# AR component
if (p!=0):
AR_multiplicands = [1-xi1*cmath.exp(2j*pi*f) for xi1 in xi1]
AR_factor = np.prod(np.abs(AR_multiplicands)**2)
else: AR_factor = 1
# Gegenbauer component
if(k!=0):
G_multiplicands = np.power(4*np.square(np.cos(2*pi*f)-np.array(Lambda)),delta)
G_factor = np.prod(G_multiplicands)
else: G_factor = 1
return sigma_epsilon*(MA_factor/AR_factor*1/G_factor)
#return(MA_factor/AR_factor*1/G_factor)
# vectorized version
def S_Y_vec(f,alpha1,omega1,alpha2,omega2,Lambda,delta,sigma_epsilon,p,q,k,as_list=False):
SDF = [S_Y(f,alpha1,omega1,alpha2,omega2,Lambda,delta,sigma_epsilon,p,q,k) for f in f]
if as_list == True: return SDF
return np.array(SDF)
where $\boldsymbol\eta$ is the vector of parameters $$ \begin{align*} \boldsymbol\eta=(&\alpha_{11},\dots,\alpha_{1R_p},\alpha_{11}^*,\dots,\alpha_{1C_p}^*,\omega_{11},\dots,\omega_{1R_p},\omega_{11}^*,\dots,\omega_{1C_p}^*, \\ &\alpha_{21},\dots,\alpha_{2R_q},\alpha_{21}^*,\dots,\alpha_{2C_q}^*,\omega_{21},\dots,\omega_{2R_q},\omega_{21}^*,\dots,\omega_{2C_q}^*, \\ &\delta_{11},\dots,\delta_{1k},\lambda_{11},\dots,\lambda_{1k},\sigma_\epsilon^2) \end{align*} $$ and $Z=\big(Z_0=\hat{S}_p(f_0)\dots,Z_J=\hat{S}_p(f_J)\big)$ is the vector of periodogram values evaluated at the Fourier frequencies $f_j=\frac{j}{N},\quad j\in{\{0,1,...,J=N/2\}}$.
def Fejer(f,sampling_interval=1,N=None):
if N is None: N = len(f); assert N>0
#if f[0] == 0:
#F = sampling_interval/(2*pi*n)*(np.sin(n*f[1:]*sampling_interval/2)**2)/(np.sin(f[1:]*sampling_interval/2)**2)
#F = np.insert(F,0,sampling_interval*n/(2*pi))
#else:
warnings.filterwarnings('ignore') # ignore division by 0 in sin(0)/sin(0)
F = sampling_interval*(np.sin(N*f*pi*sampling_interval)**2)/(N*np.sin(f*pi*sampling_interval)**2)
if 0 in f:
zero_index = np.where(f == 0)[0][0]
F[zero_index] = sampling_interval*N/(2*pi)
return F
def W_l(f,Z,
alpha1R, alpha1C, omega1C,
alpha2R, alpha2C, omega2C,
Lambda, delta, sigma_epsilon,
Rp,Cp,Rq,Cq,k,
normal=False,correction=False,
debiased=False, debiasing_type=1,
return_terms=False):
## Whittle loglikelihood (master function)
'''
parameters alpha and omega must be lists
return the Whittle loglikelihood
Options (bool):
- debiased: performs debiasing as in Sykulski (2019)
debiasing_type = 1 does so via direct convolution with Fejer's kernel
debiasing_type = 2 does so using the formula based on the autocovariance
- normal (experimental): normalises the periodogram and the sdf to the range [0,1] to improve stability of the ratio
- correction: adds the correction term from McCoy & Stephens (2004)
- return_terms: return the Whittle loglikelihood and its components in a dictionary
'''
assert len(f) == len(Z)
assert len(alpha1R) == Rp
assert len(alpha1C) == len(omega1C) == Cp
assert len(alpha2R) == Rq
assert len(alpha2C) == len(omega2C) == Cq
assert len(Lambda) == len(delta) == k
# build the parameters for the SDF
p = Rp + 2*Cp
q = Rq + 2*Cq
alpha1 = alpha1R + alpha1C
omega1R = [0]*Rp
omega1 = omega1R + omega1C
alpha2 = alpha2R + alpha2C
omega2R = [0]*Rq
omega2 = omega2R + omega2C
# Evaluate the SDF at the Fourier frequencies:
if debiased == True:
Delta = 1
n = 2*(len(f)-1) # equal to the length of the original data
omega_freqs = 1/(n*Delta)*np.arange(-ceil(n/2)+1,floor(n/2)+1)
# variant 1 - direct convolution with Fejer's kenel – formula (8) in Syklski
if debiasing_type==1:
S_Y_f = S_Y_vec(omega_freqs,alpha1,omega1,alpha2,omega2,
Lambda,delta,sigma_epsilon,p,q,k)
S_Y_f = np.convolve(S_Y_f,Fejer(omega_freqs),mode='same')
S_Y_f = S_Y_f[(n//2-1):]/n # take only right side of symmetric spectrum
# variant 2 – time-domain multiplications – formula (9) in Sykulski
elif debiasing_type==2:
# seems to give same result as no debiasing
S_Y_f = S_Y_vec(f,alpha1,omega1,alpha2,omega2,
Lambda,delta,sigma_epsilon,p,q,k)
acvs = np.fft.irfft(S_Y_f)
fft_sum = np.array([sum([(1-tau/n)*acvs[tau]*cmath.exp(-1j*2*pi*f*tau*Delta) for tau in range(0,n-1)]) for f in omega_freqs])
S_Y_f = 2*Delta*fft_sum.real - Delta * acvs[0]
S_Y_f = S_Y_f[(n//2-1):] # take only right side of symmetric spectrum
else:
S_Y_f = S_Y_vec(f,alpha1,omega1,alpha2,omega2,
Lambda,delta,sigma_epsilon,p,q,k)
# optional: bring the SDF and periodogram to the same scale
# by normalising both to [0,1] (as only the relative magnitude at same location matters)
if normal == True:
S_Y_f = normalise(S_Y_f,as_list=True)
Z = normalise(Z,as_list=True)
# define regularized log and division functions to deal with zeros:
def Div(x,y):
return x / max(y,1e-15)
def Log(x):
return log(max(x,1e-15))
# build the summands for the sum from j=1 to J-1
l_summands = [Log(s) + Div(z,s) for s, z in zip(S_Y_f, Z)]
if correction == True:
W_l = -sum(l_summands[1:-1])-1/2*(Div(Z[0],S_Y_f[0])+Div(Z[-1],S_Y_f[-1])+Log(Z[0]*S_Y_f[0])+Log(Z[-1]*S_Y_f[-1]))
#older: W_l = -sum(l_summands[1:(J-1)])-1/2*(Div(Z[0],S_Y_f[0])+Div(Z[(J)],S_Y_f[(J)]) +Log(Z[0]*S_Y_f[0])+Log(Z[(J)]*S_Y_f[(J)]))
else: W_l = -sum(l_summands)
# optional: analyse which components contribute most to the likelihood
if return_terms == True:
return {'W_l':W_l,
'l_summands':l_summands,
'S_Y_f':S_Y_f,
'Z':Z,
'Log(S_Y_f)':[Log(s) for s in S_Y_f],
'Z/S_Y_f':[Div(z,s) for s, z in zip(S_Y_f, Z)],
'Z0/S_f0':Div(Z[0],S_Y_f[0]),
'ZJ/S_fJ':Div(Z[-1],S_Y_f[-1]),
'Log(Z0*S_f0)':Log(Z[0]*S_Y_f[0]),
'Log(ZJ*S_fJ)':Log(Z[-1]*S_Y_f[-1])}
return W_l
## Function to collect parameters from output parameter vector
def extract_parameters(param,Rp,Cp,Rq,Cq,k,merged=False,display=False):
'''
Parameters are extracted from the sampling output vector,
which is of the form:
param = (alpha1R,alpha1C,omega1C,alpha2R,alpha2C,omega2C,lambda,delta, sigma_epsilon)
The result is :
(alpha1,omega1,alpha2,omega2,lambda,delta,sigma_epsilon) if merged is True
(alpha1R,alpha1C,omega1R,omega1C,alpha2R,alpha2C,omega2R,omega2C,lambda,delta,sigma_epsilon) if merged is False
'''
split_chunks = [Rp, Cp, Cp, Rq, Cq, Cq, k, k, 1]
it = iter(param)
param_list = [list(islice(it, i)) for i in split_chunks]
alpha1R = param_list[0]
alpha1C = param_list[1]
alpha1 = alpha1R + alpha1C
omega1R = [0]*Rp
omega1C = param_list[2]
omega1 = omega1R + omega1C
alpha2R = param_list[3]
alpha2C = param_list[4]
alpha2 = alpha2R + alpha2C
omega2R = [0]*Rq
omega2C = param_list[5]
omega2 = omega2R + omega2C
Lambda = param_list[6]
delta = param_list[7]
sigma_epsilon = param_list[8]
if (display==True):
print("alpha1R: ",alpha1R,"\n")
print("alpha1C: ",alpha1C,"\n")
print("omega1R: ",omega1R,"\n")
print("omega1C: ",omega1C,"\n")
print("alpha2R: ",alpha2R,"\n")
print("alpha2C: ",alpha2C,"\n")
print("omega2R: ",omega2R,"\n")
print("omega2C: ",omega2C,"\n")
print("lambda: ",Lambda,"\n")
print("delta: ",delta,"\n")
print("sigma_epsilon: ",sigma_epsilon,"\n")
if merged == False:
# remove sigma_epsilon list entry and replace with single value
return param_list[:-1]+sigma_epsilon
#return alpha1R+alpha1C+omega1C+alpha2R+alpha2C+omega2C+Lambda+delta+sigma_epsilon
return alpha1+omega1+alpha2+omega2+Lambda+delta+sigma_epsilon
## Function to plot the SDF with the periodogram and the locations of the periodogram peaks (optional)
# still has some bugs left around the AR peaks locations
# not all combinations are supported
def plot_SDF(freqs,SDF_vals,periodogram_vals=None,true_vals=None,
with_peaks=False,Lambda=None,alpha1C=None,omega1C=None,
log=False,align_scale=False,
title='SDF',periodogram_display='line',estimated_legend=True):
# make frequency grids with same endpoints but potentially different resolutions
freqs_SDF = np.linspace(np.min(freqs),np.max(freqs),len(SDF_vals))
if periodogram_vals is not None: freqs_per = np.linspace(np.min(freqs),np.max(freqs),len(periodogram_vals))
if true_vals is not None: freqs_true = np.linspace(np.min(freqs),np.max(freqs),len(true_vals))
# set plotting colours and legend labels
color_vals = ['royalblue','dimgray','black','red','green']
if estimated_legend == True:
label_vals = ['Estimated Spectrum','Periodogram','True Spectrum','Estimated AR peaks','Estimated Gegenbauer peaks']
else: label_vals = ['Spectrum','Periodogram','True Spectrum','AR peaks','Gegenbauer peaks']
col_legends = [mpatches.Patch(color=color_vals[0], label=label_vals[0])]
legend_length = 1
if periodogram_vals is not None:
legend_length += 1
col_legends += [mpatches.Patch(color=color_vals[1], label=label_vals[1])]
if true_vals is not None:
legend_length += 1
col_legends += [mpatches.Patch(color=color_vals[2], label=label_vals[2])]
# option to plot on dB scale
if (log==True):
plt.plot(freqs_SDF,10*np.log10(SDF_vals),linewidth=2,color=color_vals[0])
# option to plot the true spectum (for simulated processes)
if true_vals is not None:
plt.plot(freqs_true,10*np.log10(true_vals),linewidth=2,linestyle='dashed',color=color_vals[2])
else:
plt.plot(freqs_SDF,SDF_vals,linewidth=2,color=color_vals[0])
# option to plot the true spectum (for simulated processes)
if true_vals is not None:
plt.plot(freqs_true,true_vals,linewidth=2,linestyle='dashed',color=color_vals[2])
# option to plot the periodogram
if periodogram_vals is not None:
# option to align scales (should be aligned anyway by construction)
if align_scale == True:
scaling=np.max(periodogram_vals)/np.max(SDF_vals)
#scaling = np.max(np.divide(periodogram_vals,SDF_vals))
print(scaling)
periodogram_vals = periodogram_vals/scaling
# option to plot the periodogram on log scale
if (log==True):
if periodogram_display=='line': plt.plot(freqs_per[1:], 10*np.log10(periodogram_vals[1:]),linewidth=1,color=color_vals[1])
if periodogram_display=='bar': plt.bar(freqs_per[1:], 10*np.log10(periodogram_vals[1:]), width=0.002,color=color_vals[1],alpha=0.6)
else:
if periodogram_display=='line': plt.plot(freqs_per, periodogram_vals,linewidth=1,color=color_vals[1])
if periodogram_display=='bar': plt.bar(freqs_per, periodogram_vals, width=0.002,color=color_vals[1],alpha=0.6)
# option to plot the AR and Gegenbauer spectral peaks
if (with_peaks == True):
if Lambda is not None and alpha1C is not None: color_index = (3,4)
if Lambda is None and alpha1C is not None: color_index = (3,3)
if Lambda is not None and alpha1C is None: color_index = (3,3)
# AR peaks
if alpha1C is not None and len(alpha1C)>0 and omega1C is not None and len(omega1C)==len(alpha1C):
legend_length += 1
col_legends += [mpatches.Patch(color=color_vals[color_index[0]], label=label_vals[color_index[0]])]
AR_peak_locations = 1/(2*pi)*np.arccos(np.divide((1+np.square(alpha1C)),(2*np.array(alpha1C)))*np.cos(2*pi*np.array(omega1C)))
#AR_peak_exponents = [alpha*np.cos(2*pi*omega)+cmath.sqrt(np.cos(2*pi*omega)**2-1)/abs(alpha) for (alpha,omega) in zip(alpha1C,omega1C)]
#AR_peak_locations = np.array([1/(2*pi*1j)*cmath.log(u) for u in AR_peak_exponents])
for peak_location in AR_peak_locations: plt.axvline(x=peak_location,color=color_vals[color_index[0]],linewidth=1,linestyle='dashed')
# Gegenbauer peaks
if Lambda is not None and len(Lambda)>0:
legend_length += 1
col_legends += [mpatches.Patch(color=color_vals[color_index[1]], label=label_vals[color_index[1]])]
G_peak_locations = 1/(2*pi)*np.arccos(Lambda)
for peak_location in G_peak_locations: plt.axvline(x=peak_location,color=color_vals[color_index[1]],linewidth=1,linestyle='dashed')
# legend
if legend_length > 1:
#col_legends = [mpatches.Patch(color=color_vals[i], label=label_vals[i]) for i in range(legend_length)]
plt.legend(handles = col_legends, prop={'size': 12})
plt.xlabel("Frequency",fontsize=16)
if (log==True): plt.ylabel('log Spectrum (dB)',fontsize=16)
else: plt.ylabel('Spectrum',fontsize=16)
plt.title(title,fontsize=16)
## Test the above functions
#Test inputs
Rp_test=1
Cp_test=1
p_test=Rp_test+2*Cp_test
# MA(q) model specification
Rq_test=0
Cq_test=1
q_test=Rq_test+2*Cq_test
# Gegenbauer(k) model specification
k_test=2
nparam_test = Rp_test+2*Cp_test+Rq_test+2*Cq_test+2*k_test+1
alpha1R_test = [0.2]#list(np.random.uniform(0,1,Rp_test))#[0.2875774]#
alpha1C_test = [0.9]#list(np.random.uniform(0,1,Cp_test))#[0.9]# # get peaks when these are close to 1
alpha1_test = alpha1R_test + alpha1C_test
omega1R_test = [0] * Rp_test
omega1C_test = [0.1]#list(np.random.uniform(0,1/2,Cp_test))#[0.3941526] #
omega1_test = omega1R_test + omega1C_test
alpha2R_test = []#list(np.random.uniform(0,1,Rq_test))#[0.4089769] #
alpha2C_test = [0.2]#list(np.random.uniform(0,1,Cq_test))#[0.8830174] #
alpha2_test = alpha2R_test + alpha2C_test
omega2R_test = [0] * Rq_test
omega2C_test = [0.1]#list(np.random.uniform(0,1/2,Cq_test))#[0.4702336] #
omega2_test = omega2R_test + omega2C_test
lambda_test = [-0.3,-0.9] #list(np.random.uniform(-1,1,k_test))#[-0.908887]#
delta_test = [0.4,0.45] #list(np.random.uniform(0,1/2,k_test))#[0.2640527]#
sigma_epsilon_test = 1 #0.19
param_test=alpha1R_test+alpha1C_test+omega1C_test+alpha2R_test+alpha2C_test+omega2C_test+lambda_test+delta_test+[sigma_epsilon_test]
print("Model specified: GARMA (",p_test,",",k_test,",",q_test,")", "\n")
print("Number of parameters to estimate: ",nparam_test, "\n")
param_list_test = extract_parameters(param_test,Rp_test,Cp_test,Rq_test,Cq_test,k_test,merged=False,display=True)
# test: note the difference between the Gegenbauer peak (left) and the AR peak (right)
xi1_test = xi_builder(alpha1_test,omega1_test)
xi2_test = xi_builder(alpha2_test,omega2_test)
print("xi1: ",xi1_test,"\n")
print("xi2: ",xi2_test,"\n")
W_l_test = W_l(f,Z,
alpha1R_test, alpha1C_test, omega1C_test,
alpha2R_test, alpha2C_test, omega2C_test,
lambda_test, delta_test, sigma_epsilon_test,
Rp_test,Cp_test,Rq_test,Cq_test,k_test)
print('W_l:',W_l_test)
S_Y_test = S_Y_vec(f,alpha1_test,omega1_test,alpha2_test,omega2_test,
lambda_test,delta_test,sigma_epsilon_test,p_test,q_test,k_test)
plot_SDF(f,S_Y_test,with_peaks=True,Lambda=lambda_test,alpha1C=alpha1C_test,omega1C=omega1C_test,log=False,box=False,title='',periodogram_vals=Z)
Model specified: GARMA ( 3 , 2 , 2 ) Number of parameters to estimate: 10 alpha1R: [0.2] alpha1C: [0.9] omega1R: [0] omega1C: [0.1] alpha2R: [] alpha2C: [0.2] omega2R: [] omega2C: [0.1] lambda: [-0.3, -0.9] delta: [0.4, 0.45] sigma_epsilon: [1] xi1: [0.2 +0.j 0.72811529+0.52900673j 0.72811529-0.52900673j] xi2: [0.1618034+0.11755705j 0.1618034-0.11755705j] W_l: -300.60935690398287
## Inspect the components of the log-likelihood
W_l_test = W_l(f,Z,
alpha1R_test, alpha1C_test, omega1C_test,
alpha2R_test, alpha2C_test, omega2C_test,
lambda_test, delta_test, sigma_epsilon_test,
Rp_test,Cp_test,Rq_test,Cq_test,k_test,
return_terms=True,correction=False,debiased=False,debiasing_type=2)
print('W_l:',W_l_test['W_l'])
print('exp(W_l):',exp(W_l_test['W_l']))
# check for problem here; summands should not be too far from 1
print('l_summands:',-sum(W_l_test['l_summands'][1:-1]))
# the following additive terms in the correction are not the problem
print('Z0/S_f0:',W_l_test['Z0/S_f0']) # close to 0, so not a problem
print('ZJ/S_fJ:',W_l_test['ZJ/S_fJ']) # relatively large, but not a problem
print('Log(Z0*S_f0):',W_l_test['Log(Z0*S_f0)'])
print('Log(ZJ*S_fJ):',W_l_test['Log(ZJ*S_fJ)'])
# the problem are the values in l_summands corresponding to peaks
print('len (no. of summands):',len(W_l_test['l_summands']))
print('min ratio:',min(W_l_test['l_summands']))
print('max ratio:',max(W_l_test['l_summands']))
print('mean ratio:',np.mean(W_l_test['l_summands']))
print('median ratio:',np.median(W_l_test['l_summands']))
display(pd.DataFrame({key: W_l_test[key] for key in ['l_summands','Z','Z/S_Y_f','S_Y_f','Log(S_Y_f)']}).sort_values(by=['Z/S_Y_f'],ascending=False).round(3).head(10))
# also note that the three highest peaks are harmonics: 28, 56, 112
# sometimes 112 does not rank that high, but 56 and 28 are always at the top (depends on the seed)
# the problem comes exclusively from the periodogram
# hence need to normalize the periodogram, as that would simply propagate the scaling
# plot the components
#plt.bar(range(len(W_l_test['S_Y_f'])),height=W_l_test['S_Y_f'])
#plt.bar(range(len(W_l_test['l_summands'])),height=W_l_test['l_summands'])
#plt.bar(range(len(W_l_test['l_summands'][:28])),height=W_l_test['l_summands'][:28])
#plt.bar(range(len(W_l_test['l_summands'][29:56])),height=W_l_test['l_summands'][29:56])
#plt.bar(range(len(W_l_test['l_summands'][57:112])),height=W_l_test['l_summands'][57:112])
#plt.bar(range(len(W_l_test['l_summands'][113:])),height=W_l_test['l_summands'][113:])
W_l: -300.60935690398287 exp(W_l): 2.7990785626054594e-131 l_summands: -301.6426752920181 Z0/S_f0: 7.537633175685261e-31 ZJ/S_fJ: 0.007470376048900309 Log(Z0*S_f0): -34.538776394910684 Log(ZJ*S_fJ): -6.761476898407563 len (no. of summands): 251 min ratio: -0.961612985472281 max ratio: 7.203221079622762 mean ratio: 1.1976468402549119 median ratio: 0.862658972430642
| l_summands | Z | Z/S_Y_f | S_Y_f | Log(S_Y_f) | |
|---|---|---|---|---|---|
| 72 | 7.203 | 9.642 | 6.863 | 1.405 | 0.340 |
| 97 | 5.913 | 3.002 | 6.719 | 0.447 | -0.806 |
| 107 | 5.104 | 2.305 | 6.073 | 0.379 | -0.969 |
| 152 | 6.159 | 10.917 | 5.467 | 1.997 | 0.692 |
| 119 | 3.973 | 1.857 | 4.954 | 0.375 | -0.981 |
| 87 | 4.070 | 2.783 | 4.564 | 0.610 | -0.495 |
| 213 | 6.361 | 27.610 | 4.560 | 6.055 | 1.801 |
| 36 | 5.449 | 14.651 | 4.200 | 3.488 | 1.249 |
| 187 | 3.345 | 1.832 | 4.167 | 0.440 | -0.822 |
| 1 | 3.893 | 3.592 | 4.000 | 0.898 | -0.108 |
# plt.plot(W_l_test['l_summands'])
# plt.plot(S_Y_test)
# plt.plot(Z)
## Function to set the bounds for the model
def set_bounds(Rp,Cp,Rq,Cq,k,eps=0):
# lower bounds for uniform priors
lb_unif=([0+eps]*(Rp+Cp)+ # alpha1R and alpha1C 0
[0+eps]*Cp + # omega1C 0
[0+eps]*(Rq+Cq)+ # alpha2R and alpha2C 0
[0+eps]*Cq+ # omega2C 0
[-1+eps]*k+ # lambda -1
[0+eps]*k) # delta 0
#+[0+eps]) # sigma_epsilon 0
lb_param = lb_unif+[0] # add lb=0 for sigma_epsilon
# upper bounds for uniform priors
ub_unif=([1-eps]*(Rp+Cp)+ # alpha1R and alpha1C 1
[1/2-eps]*Cp+ # omega1C 1/2
[1-eps]*(Rq+Cq)+ # alpha2R and alpha2C 1
[1/2-eps]*Cq+ # omega2C 1/2
[1-eps]*k+ # lambda 1
[1/2-eps]*k) # delta 1/2
#+[+np.inf]) # sigma_epsilon +inf
ub_param = ub_unif+[+np.inf] # add ub=+inf for sigma_epsilon
return lb_param, ub_param
# Uniform priors on model parameters
def uniform_pdf(lb,ub):
return 1/(ub-lb)
# Inverse Gamma prior on innovation variance sigma_epsilon
def invgamma_pdf(x,alpha=1,beta=1):
return (beta**alpha)/gamma(alpha)*(1/x)**(alpha+1)*exp(-beta/x)
# Truncated Normal prior on innovation variance sigma_epsilon
def truncnormal_pdf(x,lb,ub,mean,std):
a, b = (lb - mean) / std, (ub - mean) / std
return truncnorm.pdf(x, a, b, loc = mean, scale = std)
# Functions to sample from the prior
# (used in the initialization and in annealing):
# Uniform priors on model parameters
def uniform_sample(N,lb,ub):
return np.random.uniform(lb,ub,size=N)
# Inverse Gamma prior (diffuse) on innovation variance sigma_epsilon
def invgamma_sample(N,alpha=3,beta=1,ub=30):
'''
When alpha < n, the n-th moment (and above) do not exist.
In particular, when alpha < 3 and especially when alpha is close to 1,
the gamma distribution has most values around 0, so inverting it leads
to many very large values, making the historgram not correspond to the
theoretical shape of the pdf (i.e. very heavy tails).
To address this, generate a much larger sample, remove the values greater than
a threshhold, say 30, reshuffle the reduced sample, and extract the first N values.
'''
if alpha >= 3:
return invgamma.rvs(a=alpha,scale=beta,size=N)
else:
extended_sample = invgamma.rvs(a=alpha,scale=beta,size=10*N)
reduced_sample = extended_sample[(extended_sample<ub)]
shuffle(reduced_sample)
return reduced_sample[:N]
# same as invgamma.rvs(a=alpha,size=N)*beta
# same as 1/sp.stats.gamma.rvs(a=alpha,scale=1/beta,size=N)
# Truncated Normal proposal
def truncnormal_sample(N,lb,ub,mean=0.5,std=2):
'''
location mean and scale (std dev) std
left and right limits lb, ub
default mean and std parameters are for diffuse prior for sigma_epsilon
'''
a, b = (lb - mean) / std, (ub - mean) / std
return truncnorm.rvs(a, b, loc = mean, scale = std, size=N)
fig, (ax1,ax2,ax3,ax4) = plt.subplots(4,1)
# Inverse Gamma
ax1.hist(invgamma_sample(5000,1,1,ub=30),bins=500,density=True,histtype='stepfilled',alpha=0.5)
ax1.plot(np.arange(0.01,5,0.01),[invgamma_pdf(x) for x in np.arange(0.01,5,0.01)])
ax1.set_xlim(0,5)
ax1.set_ylim(0,2)
# Truncated Normal
ax2.hist(truncnormal_sample(2000,0,+np.inf,1,0.1),bins=200,density=True,histtype='stepfilled',alpha=0.5)
ax2.plot(np.arange(0,5,0.01),[truncnormal_pdf(x,0,+np.inf,1,0.1) for x in np.arange(0,5,0.01)])
ax2.set_xlim(0,3)
ax2.set_ylim(0,6)
# proposal for parameter between -1 and 1 (lambda), std of 1/4 the length of the range (2)
ax3.hist(truncnormal_sample(2000,-1,1,0.3,1/2),bins=200,density=True,histtype='stepfilled',alpha=0.5)
ax3.plot(np.arange(-1,1,0.01),[truncnormal_pdf(x,-1,1,0.3,1/2) for x in np.arange(-1,1,0.01)])
# half-normal prior for sigma_epsilon
ax4.hist(truncnormal_sample(2000,0,+np.inf,np.var(y)/2,np.var(y)),bins=200,density=True,histtype='stepfilled',alpha=0.5)
ax4.plot(np.arange(0,10,0.01),[truncnormal_pdf(x,0,+np.inf,np.var(y)/2,np.var(y)) for x in np.arange(0,10,0.01)])
[<matplotlib.lines.Line2D at 0x7fa2f26af160>]
# joint prior pdf
def prior_pdf(param,lb,ub,sigma_prior,*args):
unif_priors_list = [uniform_pdf(lb,ub) for lb, ub in zip(lb[:-1],ub[:-1])]
if sigma_prior == 'invgamma':
if len(args)==2: alpha, beta = args
else: alpha, beta = 1, 1
joint_prior = np.prod(unif_priors_list)*invgamma_pdf(param[-1],alpha,beta)
elif sigma_prior == 'truncnormal':
if len(args)==2: mean, std = args
else: mean, std = 0.5, 2
joint_prior = np.prod(unif_priors_list)*truncnormal_pdf(param[-1],lb[-1],ub[-1],mean,std)
elif sigma_prior == 'uniform':
if len(args)==2: lb_sigma, ub_sigma = args
else: lb_sigma, ub_sigma = 0, 5
joint_prior = np.prod(unif_priors_list)*uniform_pdf(lb_sigma,ub_sigma)
return joint_prior
# joint prior sample
def prior_sample(Rp,Cp,Rq,Cq,k,sigma_prior,*args):
# returns 1 sample from the prior
sample = ()
# append a realisation of each model parameter
for (N,lb,ub) in zip([Rp,Cp,Cp,Rq,Cq,Cq,k,k],[0,0,0,0,0,0,-1,0],[1,1,1/2,1,1,1/2,1,1/2]):
sample += tuple(uniform_sample(N,lb,ub))
# append a realisation of the innovation variance
if sigma_prior == 'invgamma':
if len(args)==2: alpha, beta = args
else: alpha, beta = 1, 1
sample += tuple(invgamma_sample(1,alpha,beta))
elif sigma_prior == 'truncnormal':
if len(args)==2: mean, std = args
else: mean, std = 0.5, 2
sample += tuple(truncnormal_sample(1,0,+np.inf,mean,std))
elif sigma_prior == 'uniform':
if len(args)==2: lb_sigma, ub_sigma = args
else: lb_sigma, ub_sigma = 0, 5
sample += tuple(uniform_sample(1,lb_sigma,ub_sigma))
return sample
# target loglikelihood taking grouped inputs
def loglik(param,data,model_spec):
# unzip data and model specification
f,Z = data
Rp,Cp,Rq,Cq,k = model_spec
# extract parameters
param_list = extract_parameters(param,Rp,Cp,Rq,Cq,k,merged=False,display=False)
# unzip parameters
alpha1R = param_list[0]
alpha1C = param_list[1]
omega1C = param_list[2]
alpha2R = param_list[3]
alpha2C = param_list[4]
omega2C = param_list[5]
Lambda = param_list[6]
delta = param_list[7]
sigma_epsilon = param_list[8]
# return Whittle loglikelihood
# N = 2 * len(f) # length of the data
return (W_l(f,Z,
alpha1R, alpha1C, omega1C,
alpha2R, alpha2C, omega2C,
Lambda, delta, sigma_epsilon,
Rp,Cp,Rq,Cq,k,
correction=False,debiased=False))# * 1/N (does not work well – has same effect as loglik scaling)
# unnormalized (log) prior and posterior:
def logprior(param,lb,ub,sigma_prior,*args):
return np.log(max(prior_pdf(param,lb,ub,sigma_prior,*args),1e-20))
def logposterior(param,lb,ub,data,model_spec,sigma_prior,*args):
return logprior(param,lb,ub,sigma_prior,*args) + loglik(param,data,model_spec)
def initialize_particles(N_particles,model_spec,sigma_prior,*args):
'''
each particle is a vector of the parameters (alpha1R,...,sigma_epsilon)
initialize N_particles from the prior
'''
Rp,Cp,Rq,Cq,k = model_spec
return [prior_sample(Rp,Cp,Rq,Cq,k,sigma_prior,*args) for _ in range(N_particles)]
Bridging densities $\pi_t(x) \propto \pi(x) L(x|Z)^{\gamma_t}, \: t=0,\dots,N; \: \gamma_0 = 0 <\dots<\gamma_N=1$, where $N$ is the length of the schedule, $\gamma_t$ are the temperatures, $\pi(x)$ is the prior and $L(x|Z)$ is the posterior.
# log of bridging densities going from the prior to the posterior
# this is likelihood annealing – see Neal (2001)
def logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t,N,spacing='linear',*args):
if spacing == 'linear':
gamma = list(np.linspace(start=0,stop=1,num=N+1))
elif spacing == 'geometric':
gamma = [0]+list(np.geomspace(1/N,1,N))
target = logprior(x,lb,ub,sigma_prior,*args) + gamma[t] * loglik(x,data,model_spec)
# same as target = (1-gamma[j]) * logprior(x,lb,ub) + gamma[j] * logposterior(x,lb,ub)
return target
Truncated normal proposal for all parameters, except $\sigma_\epsilon^2$, for which the proposal is half-normal, as this parameter has an inverse gamma rather than a uniform prior, and thus only has a lower bound of 0, but no upper bound.
# random walk proposals for each parameter
def proposal(lb,ub,x,delta):
'''
PROPOSAL FOR THE NEXT PARTICLE (EN-BLOCK)
x is the vector of previous estimates
lb, ub are the bounds of the parameters
delta = (delta_params,delta_sigma) is a tuple with two elements:
- the standard deviation of the truncated normal proposals for the model parameters,
espressed as a fraction (or multiple) of the parameter range
- the standard deviation of the half-normal (truncated normal with ub=+inf) proposal
for the innovations variance, expressed as a positive real number
'''
# generates one (truncated) gaussian r.v. with mean x,
# variance delta for each parameter
std_list = [delta[0]*(ub-lb) for (lb, ub) in zip(lb[:-1], ub[:-1])]+[delta[1]]
return [truncnormal_sample(1, lb, ub, mean = x, std = std)[0] for (lb,ub,x,std) in zip(lb,ub,x,std_list)]
# compute Effective Sample Size (ESS)
def compute_ESS(weights):
sq_sum = sum([w**2 for w in weights])
return 1.0/sq_sum
# resample particles – see Naesseth 2019
# weighted multinomial resampling
def multinomial_resampling(particles, weights):
particles, weights = np.array(particles), np.array(weights)
u = np.random.rand(*weights.shape)
bins = np.cumsum(weights)
particles_new = particles[np.digitize(u,bins)]
return list(map(tuple, particles_new))
# stratified resampling (potentially better)
def stratified_resampling(particles, weights):
particles, weights = np.array(particles), np.array(weights)
N = weights.shape[0]
u = (np.arange(N) + np.random.rand(N))/N
bins = np.cumsum(weights)
return particles[np.digitize(u,bins)]
# SMC sampler
def smc_sampler(particles, lb, ub, data, model_spec,
sigma_prior = 'invgamma', *args, # data, prior & proposal settings
delta = (1/4,0.1), N_bridges = 10, N_updates = 5, # sampler settings
spacing = 'linear', resampling = True, MCMC = True, alpha=1/2,
loglik_scaling = False, verbose = True, print_diagnostic = False):
'''
particles (list of tuples): list of length N_particles with the samples
(tuples of model parameters)
lb, ub (lists): lists of length N_param with the upper and lower bounds
for each model parameter
data (tuple): data = (f,Z), containing f (Fourier frequencies) and Z (periodogram values)
model_spec (tuple): model_spec = (Rp,Cp,Rq,Cq,k), model specification
delta (tuple with 2 entries): the proposal variances
the first is entry is a fraction (of the range of each model parameter)
the second is a positive number (for the innovation variance sigma_epsilon)
N_bridges (int): number of bridging/intermediate densities pi_j
(total N_bridges+1, ranging from prior (0) to posterior (N))
N_updates (int): number of MCMC iterations/updates (the R_t in Li 2021)
spacing (str): the spacing of the bridging densities ('linear' or 'geometric')
resampling (bool): if True, resample once the ESS goes below alpha*N_particles
MCMC (bool): if True, perform MCMC rejuvenation in the resampling step
alpha (float in (0,1]): ESS threshold for resampling, to be multiplied by N_particles (default is 1/2)
loglik_scaling (bool): if True, apply scaling to the logdensities in SIS and MCMC
for numerical stability (so that exponentiation does not give 0.0)
verbose (bool): if True, print the status at each iteration
'''
# initialise the weights
N_particles = len(particles)
weights = [1.0/N_particles]*N_particles
# initialise the ESS history
ESS_history = []
# initialise the counter of resamplings,
resampling_iterations = []
# initialise the MCMC acceptance rates (list of lists)
MCMC_accept_rates_all = []
# initialise the array of weights (particles as columns, iterations as rows)
weights_aray = np.ones((N_bridges+1,N_particles))
# initialise the global start time
start_time = time.time()
# experimental feature – scaling factor = order of magnitude of median absolute value of loglikelihood for each particle
if loglik_scaling == True:
median_abs_loglik = np.median(np.abs([loglik(x,data,model_spec) for x in particles]))
scaling_factor = 10**floor(log(median_abs_loglik,10)) #also try round instead of floor
print('Loglikelihood scaling factor: ', scaling_factor)
print('Median absolute Loglikelihood for initial particles: ',round(median_abs_loglik,2),'\n')
else: scaling_factor = 1
# SIS procedure
for t in range(N_bridges+1):
# record the system time at the previous iteration
if t==0: prev_time=start_time
else: prev_time = time.time()
# display status – started iteration
if verbose: print('Iteration {0} out of {1}:'.format(t+1, N_bridges+1))
# evolve each particle with pi_t as the target
for k in range(N_particles):
x = particles[k]
# multiply the initial weight by the prior if at the first bridging density
if t == 0:
L_W = logprior(x,lb,ub,sigma_prior,*args)/scaling_factor
weights[k] = weights[k] * exp(L_W)
# SIS (multiply the weights by the ratios of consecutive bridging densities)
else:
L_W_old = logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t-1,N_bridges,spacing,*args)/scaling_factor # pi_t-1(x)
L_W_new = logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t,N_bridges,spacing,*args)/scaling_factor # pi_t(x)
weights[k] = weights[k] * exp(L_W_new-L_W_old) # weights will be 0 and the ESS will decay fast if L_W_new-L_W_old is very negative
# L_W_old and L_W_new can be positive, as they are based on the loglikelihood
# one would subtract (on the log scale) the normalising constant in the denominator, but that would cancel out in L_W_new-L_W_old
# however, L_W_new - L_W_old cannot be too large due to exponentiation – what to do?
if print_diagnostic and k == 100: print('Scaling_factor:',scaling_factor,'Logprior:',logprior(x,lb,ub,sigma_prior,*args),'Loglik:',loglik(x,data,model_spec),'L_W_old:',L_W_old,'L_W_new:',L_W_new,'exp(L_W_new-L_W_old):',exp(L_W_new-L_W_old),'weight:',weights[k],'sigma_epsilon:',x[-1])
# end for
# renormalise weights
w_sum = sum(weights)
weights = [w/w_sum for w in weights]
# save the normalised weights
weights_aray[t] = np.array(weights)
# compute and save ESS
ESS = compute_ESS(weights)
ESS_history.append(ESS)
if verbose: print(' ESS = {0:.2f}'.format(ESS))
# resample and do MCMC if ESS < N/2 to prevent weight degeneracy
# and on on the last iteration to obtain a weighted and also less autocorrelated sample
if resampling == True and (ESS < alpha*N_particles or t == N_bridges):
if verbose and t==N_bridges: print('Final Resampling')
if verbose: print(' Started Resampling')
particles = multinomial_resampling(particles,weights)
#particles = stratified_resampling(particles,weights)
# reset weights
weights = [1.0/N_particles]*N_particles
# add marker for iteration where resampling happened (for ESS plot)
resampling_iterations.append(t+1)
# MCMC step
if MCMC == True:
if verbose: print(' Doing MCMC')
# initialise list of acceptance rates at each update to assess convergence
MCMC_accept_rates = []
for _ in range(N_updates):
acceptance_counter = 0
for k in range(N_particles):
x = particles[k]
x_new = proposal(lb,ub,x,delta)
# compute log acceptance (for numerical stability)
# use the current bridging density for the MH step
L_new = logdensity_bridge(x_new,lb,ub,data,model_spec,sigma_prior,
t,N_bridges,spacing,*args)/scaling_factor # pi_t(x_new)
L_old = logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t,N_bridges,spacing,*args)/scaling_factor # pi_t(x_old)
L_accept = L_new - L_old
# Accept the proposed value if min(exp(L_accept),1) > random() ~ Uniform(0,1)
if min(L_accept,0) > log(max(np.random.uniform(),0)):
particles[k] = x_new
acceptance_counter += 1
MCMC_accept_rates.append(acceptance_counter/N_particles)
MCMC_accept_rates_all.append(MCMC_accept_rates)
if verbose: print(' Resampled')
# display status – finished iteration (display time)
if verbose:
print('Time spent on iteration: {0:.1f}s (Total time: {1:.1f}s) \n'.format(
time.time()-prev_time, time.time()-start_time))
#loglik_list = [] # save at each iteration the average loglik accross all particles
# or at least for the last iteration to compute the BIC if keeping track of the likelihood is too costly
# compute the marginal likelihood of the model – see Neal (2001)
# multiply the weights for each bridging density, then take the mean over the number of particles
#marginal_lik = np.mean(np.prod(weights_aray,axis=0))
# save diagnostics in a dictionary
diagnostics = {'ESS': ESS_history,'resampling': resampling_iterations,'MCMC': MCMC_accept_rates_all,'weights':weights_aray}#,'loglik':loglik_list,'marginal_lik': marginal_lik}
#! RESAMPLE right at the end to get weighted sample
# and do another MCMC step to create new particles
# this will give an exact estimate of the posterior
# return output
return particles, diagnostics
def proposal_pro(lb,ub,x,delta,n):
'''
PROPOSAL FOR n-th PARAMETER WITHIN THE PARTICLE
(RETURNS PARTICLE WITH ONLY THAT PARAMETTER UPDATED)
x is the vector of previous estimates
lb, ub are the bounds of the parameters
delta = (delta_params,delta_sigma) is a tuple with two elements:
- the standard deviation of the truncated normal proposals for the model parameters,
espressed as a fraction (or multiple) of the parameter range
- the standard deviation of the half-normal (truncated normal with ub=+inf) proposal
for the innovations variance, expressed as a positive real number
n = index of parameter
'''
# generates one (truncated) gaussian r.v. with mean x,
# variance delta for each parameter
n_params = len(x) # or len(lb) or len(ub)
max_index = n_params-1
if n == max_index: # if the parameter is sigma_epsilon
std = delta[1]
else:
std = delta[0]*(ub[n]-lb[n])
param_new = truncnormal_sample(1, lb[n], ub[n], mean = x[n], std = std)[0]
# convert to list to assign item, then back to tuple
x_list = list(x)
x_list[n] = param_new
x = tuple(x_list)
return x
def smc_sampler_pro(particles, lb, ub, data, model_spec,
sigma_prior = 'invgamma', *args, # data, prior & proposal settings
delta = (1/4,0.1), N_bridges = 10, N_updates = 5, # sampler settings
spacing = 'linear', resampling = True, MCMC = True, alpha=1/2,
loglik_scaling = False, verbose = True, print_diagnostic = False):
'''
particles (list of tuples): list of length N_particles with the samples
(tuples of model parameters)
lb, ub (lists): lists of length N_param with the upper and lower bounds
for each model parameter
data (tuple): data = (f,Z), containing f (Fourier frequencies) and Z (periodogram values)
model_spec (tuple): model_spec = (Rp,Cp,Rq,Cq,k), model specification
delta (tuple with 2 entries): the proposal variances
the first is entry is a fraction (of the range of each model parameter)
the second is a positive number (for the innovation variance sigma_epsilon)
N_bridges (int): number of bridging/intermediate densities pi_j
(total N_bridges+1, ranging from prior (0) to posterior (N))
N_updates (int): number of MCMC iterations/updates (the R_t in Li 2021)
spacing (str): the spacing of the bridging densities ('linear' or 'geometric')
resampling (bool): if True, resample once the ESS goes below alpha*N_particles
MCMC (bool): if True, perform MCMC rejuvenation in the resampling step
alpha (float in (0,1]): ESS threshold for resampling, to be multiplied by N_particles (default is 1/2)
loglik_scaling (bool): if True, apply scaling to the logdensities in SIS and MCMC
for numerical stability (so that exponentiation does not give 0.0)
verbose (bool): if True, print the status at each iteration
'''
# initialise the weights
N_particles = len(particles)
N_params = len(particles[0]) # or len(ub) of len(lb)
weights = [1.0/N_particles]*N_particles
# initialise the ESS history
ESS_history = []
# initialise the counter of resamplings,
resampling_iterations = []
# initialise the MCMC acceptance rates (list of lists)
MCMC_accept_rates_all = []
# initialise the array of weights (particles as columns, iterations as rows)
weights_aray = np.ones((N_bridges+1,N_particles))
# initialise the global start time
start_time = time.time()
# experimental feature – scaling factor = order of magnitude of median absolute value of loglikelihood for each particle
if loglik_scaling == True:
median_abs_loglik = np.median(np.abs([loglik(x,data,model_spec) for x in particles]))
scaling_factor = 10**floor(log(median_abs_loglik,10)) #also try round instead of floor
print('Loglikelihood scaling factor: ', scaling_factor)
print('Median absolute Loglikelihood for initial particles: ',round(median_abs_loglik,2),'\n')
else: scaling_factor = 1
# SIS procedure
for t in range(N_bridges+1):
# record the system time at the previous iteration
if t==0: prev_time=start_time
else: prev_time = time.time()
# display status – started iteration
if verbose: print('Iteration {0} out of {1}:'.format(t+1, N_bridges+1))
# evolve each particle with pi_t as the target
for k in range(N_particles):
x = particles[k]
# multiply the initial weight by the prior if at the first bridging density
if t == 0:
L_W = logprior(x,lb,ub,sigma_prior,*args)/scaling_factor
weights[k] = weights[k] * exp(L_W)
# SIS (multiply the weights by the ratios of consecutive bridging densities)
else:
L_W_old = logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t-1,N_bridges,spacing,*args)/scaling_factor # pi_t-1(x)
L_W_new = logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t,N_bridges,spacing,*args)/scaling_factor # pi_t(x)
weights[k] = weights[k] * exp(L_W_new-L_W_old) # weights will be 0 and the ESS will decay fast if L_W_new-L_W_old is very negative
# L_W_old and L_W_new can be positive, as they are based on the loglikelihood
# one would subtract (on the log scale) the normalising constant in the denominator, but that would cancel out in L_W_new-L_W_old
# however, L_W_new - L_W_old cannot be too large due to exponentiation – what to do?
if print_diagnostic and k == 100: print('Scaling_factor:',scaling_factor,'Logprior:',logprior(x,lb,ub,sigma_prior,*args),'Loglik:',loglik(x,data,model_spec),'L_W_old:',L_W_old,'L_W_new:',L_W_new,'exp(L_W_new-L_W_old):',exp(L_W_new-L_W_old),'weight:',weights[k],'sigma_epsilon:',x[-1])
# end for
# renormalise weights
w_sum = sum(weights)
weights = [w/w_sum for w in weights]
# save the normalised weights
weights_aray[t] = np.array(weights)
# compute and save ESS
ESS = compute_ESS(weights)
ESS_history.append(ESS)
if verbose: print(' ESS = {0:.2f}'.format(ESS))
# resample and do MCMC if ESS < N/2 to prevent weight degeneracy
# and on on the last iteration to obtain a weighted and also less autocorrelated sample
if resampling == True and (ESS < alpha*N_particles or t == N_bridges):
if verbose and t==N_bridges: print('Final Resampling')
if verbose: print(' Started Resampling')
particles = multinomial_resampling(particles,weights)
#particles = stratified_resampling(particles,weights)
# reset weights
weights = [1.0/N_particles]*N_particles
# add marker for iteration where resampling happened (for ESS plot)
resampling_iterations.append(t+1)
# MCMC step
if MCMC == True:
if verbose: print(' Doing MCMC')
# initialise list of acceptance rates at each update to assess convergence
# MCMC_accept_rates = []
for _ in range(N_updates):
# acceptance_counter = 0
for k in range(N_particles):
x = particles[k]
# perform independent Metropolis Hastings for each parameter
# within the particle (can be extended to using blocks instead, e.g. updating all alpha1Rs at once)
for n in range(N_params):
x_new = proposal_pro(lb,ub,x,delta,n)
# compute log acceptance (for numerical stability)
# use the current bridging density for the MH step
L_new = logdensity_bridge(x_new,lb,ub,data,model_spec,sigma_prior,
t,N_bridges,spacing,*args)/scaling_factor # pi_t(x_new)
L_old = logdensity_bridge(x,lb,ub,data,model_spec,sigma_prior,
t,N_bridges,spacing,*args)/scaling_factor # pi_t(x_old)
L_accept = L_new - L_old
# Accept the proposed value if min(exp(L_accept),1) > random() ~ Uniform(0,1)
if min(L_accept,0) > log(max(np.random.uniform(),0)):
particles[k] = x_new
#acceptance_counter += 1
#MCMC_accept_rates.append(acceptance_counter/N_particles)
#MCMC_accept_rates_all.append(MCMC_accept_rates)
# end MCMC
if verbose: print(' Resampled')
# display status – finished iteration (display time)
if verbose:
print('Time spent on iteration: {0:.1f}s (Total time: {1:.1f}s) \n'.format(
time.time()-prev_time, time.time()-start_time))
#loglik_list = [] # save at each iteration the average loglik accross all particles
# or at least for the last iteration to compute the BIC if keeping track of the likelihood is too costly
# compute the marginal likelihood of the model – see Neal (2001)
# multiply the weights for each bridging density, then take the mean over the number of particles
#marginal_lik = np.mean(np.prod(weights_aray,axis=0))
# save diagnostics in a dictionary
diagnostics = {'ESS': ESS_history,'resampling': resampling_iterations,'MCMC': MCMC_accept_rates_all,'weights':weights_aray}#,'loglik':loglik_list,'marginal_lik': marginal_lik}
#! RESAMPLE right at the end to get weighted sample
# and do another MCMC step to create new particles
# this will give an exact estimate of the posterior
# return output
return particles, diagnostics
# Function to calculate the summary statistic for a data series
def sum_stat(estimate,statistic):
'''
statistic can be mean, median, mode
'''
if statistic == 'mean':
return np.mean(estimate)
elif statistic == 'median':
return np.median(estimate)
elif statistic == 'mode':
return Counter(estimate).most_common(1)[0][0]
# function to find the smallest element in each row of a matrix
# without repeating the column index of each row minimum
def find_smallest(mat):
mat = np.array(mat)
n_row, n_col = mat.shape[0], mat.shape[1]
smallest_vals_list = []
assert n_row == n_col
for i in range(n_row):
row = mat[i]
smallest_val_in_row = row.min()
smallest_vals_list.append(smallest_val_in_row)
smallest_index_in_row = np.where(row == smallest_val_in_row)
# remove the column corresponding to this index
# to prevent the indices being repeated
mat = np.delete(mat,smallest_index_in_row,axis=1)
return smallest_vals_list
# Function to sort second list based on distance of elements from the first list
def bi_list_sort(list1,list2,ord_type = 'map'):
'''
Returns the pairs of corresponding elements in two lists
for which the euclidean distance is minimised
Note: still has a bug when two distances in the matrix are precisely equal
'''
assert len(list1) == len(list2)
n_elem = len(list1)
# (n_elem x n_elem) distance matrix
dist_mat = sp.spatial.distance.cdist([[i] for i in list1], [[i] for i in list2], metric='euclidean')
# find smallest distance in each row
#n_smallest = [min(dist_mat[i]) for i in range(n_elem)] #np.sort(dist_mat.flatten())[:n_elem] # return the n_elem smallest distances
n_smallest = find_smallest(dist_mat)
# get coordinates of n_elem smallest elements
if ord_type == 'pairs':
n_smallest_coord = [[np.where(dist_mat == x)[i][0] for i in (0,1)] for x in n_smallest]
elif ord_type == 'map':
n_smallest_coord = [[np.where(dist_mat == x)[i][0] for x in n_smallest] for i in (0,1)]
return n_smallest_coord
def loglik_plot(particles_init,particles_SMC,data,model_spec,title=True,abs=True):
# justification for the choice of scaling factor
# median of absolute values represents well the "average" order of magnitude of the loglikelihood
loglik_list_init = [loglik(x,data,model_spec) for x in particles_init]
loglik_list_SMC = [loglik(x,data,model_spec) for x in particles_SMC]
# plot
fig, (ax1,ax2) = plt.subplots(2,figsize=(12,8))
if title == True: fig.suptitle('Absolute values of the loglikelihood (median in red)',fontsize=16)
# initial particles
if abs == True: ax1.plot(np.log10(np.abs(loglik_list_init)))
else: ax1.plot(loglik_list_init)
if abs == True: ax1.axhline(y=np.log10(np.median(np.abs(loglik_list_init))), color='r', linestyle='-')
ax1.set_title('Initial Particles',fontsize=14)
# filtered particles after SMC
if abs == True: ax2.plot(np.log10(np.abs(loglik_list_SMC)))
else: ax2.plot(loglik_list_SMC)
if abs == True: ax2.axhline(y=np.log10(np.median(np.abs(loglik_list_SMC))), color='r', linestyle='-')
ax2.set_title('Filtered Particles',fontsize=14)
# common axis labels
fig.supxlabel("Particle Index",fontsize=14)
fig.supylabel("Absolute loglikelihood",fontsize=14)
plt.tight_layout()
def ESS_plot(N_particles,ESS_vals,resampling_iterations,n_frequency=1,alpha=1/2,title=True):
ESS_range = list(range(1,len(ESS_vals)+1)) # make plotting x_vals ranging over iterations
# make tuple (low value, N_particles) where the resampling happens, used for plotting vertical lines
resample_jump_vals=[(ESS_vals[i-1],N_particles) for i in resampling_iterations]
# split the ESS into segments between resamplings
ESS_split_chunks = np.split(ESS_range,np.searchsorted(ESS_range,[x+1 for x in resampling_iterations])) # get list of lists with iterrations
ESS_split_chunks = [list(x) for x in ESS_split_chunks] # convert numpy array elements to list
# make the values for plotting
plot_vals = [[ESS_vals[i-1] for i in chunk] for chunk in ESS_split_chunks]
plot_vals_mod = [plot_vals[0]]+[[N_particles]+plot_vals[i] for i in range(1,len(plot_vals))]
# make the range for plotting
plot_range_mod = [ESS_split_chunks[0]]+[[iter]+ESS_split_chunks[i] for i, iter in zip(range(1,len(ESS_split_chunks)),resampling_iterations)]
# plot the ESS segment by segment
for (x_segment, y_segment) in zip(plot_range_mod,plot_vals_mod):
for i in range(len(x_segment)):
plt.plot(x_segment[i:i+2], y_segment[i:i+2], 'ko-', markersize=3)
# plot the vertical lines where resampling happens
plt.plot((resampling_iterations,resampling_iterations),([i for (i,j) in resample_jump_vals], [j for (i,j) in resample_jump_vals]),c='orangered',linestyle='dashed')
# set x-axis to display every n-th iteration
plt.gca().xaxis.set_major_locator(mticker.MultipleLocator(n_frequency))
# plot the ESS threshold for resampling
if alpha!=None: plt.axhline(y=alpha*N_particles, color='r', linestyle='-')
# additional plot features
plt.xlabel('Iteration',size=14)
plt.ylabel('ESS',size=14)
if title == True: plt.suptitle('Effective Sample Size (ESS) Plot',fontsize=16)
def meta_plot(model_spec,param_names,param_SMC,param_init=None,param_true=None,histogram=False,kde=True,title=True,layout=None,figsize=None,type='histogram'):
'''
can plot histogram, boxplot, or scatterplot
if param_init (initial particles) is specified, we plot the prior too
New: orders the parameters in the same class to match the true parameters (as the roots are output unidentified)
figtype = 'histogram', 'scatterplot', or 'boxplot'
'''
# get inputs
Rp, Cp, Rq, Cq, k = model_spec
N_particles = param_SMC.shape[1]
N_bins = N_particles//50 #N_particles//10
if param_init is not None: assert param_init.shape == param_SMC.shape
if param_true is not None: assert len(param_true) == param_SMC.shape[0]
# extract segmentation of parameters by type
# get mean of every parameter
param_means = [sum_stat(param,'mean') for param in param_SMC]
param_means_list = extract_parameters(param_means,Rp,Cp,Rq,Cq,k)
param_means_list[-1] = [param_means_list[-1]] # put sigma_epsilon square into its own list
# make list of segmentations for parameter means and true parameters
if param_true is not None:
param_true_list = extract_parameters(param_true,Rp,Cp,Rq,Cq,k)
param_true_list[-1] = [param_true_list[-1]] # put sigma_epsilon square into its own list
assert np.array(param_means_list,dtype='object').shape == np.array(param_true_list,dtype='object').shape
n_params = param_SMC.shape[0] # Rp+2Cp+Rq+2Cq+2k+1
n_param_classes = len(param_means_list) # 1+2+1+2+2+1 = 9
# define figure specifications
fig = plt.figure(figsize=figsize)
color_vals = ['royalblue','gray','red','mediumblue','orange']
alpha_vals = [0.8, 0.5, 1]
label_vals = ['Posterior','Empirical Prior','True Value','Sample Mean']
legend_iterable = [0]
if param_init is not None: legend_iterable.append(1)
if param_true is not None: legend_iterable.append(2)
col_legends = [mpatches.Patch(color=color_vals[k], label=label_vals[k]) for k in legend_iterable]
col_legends_boxplot = [mpatches.Patch(color=color_vals[k], label=label_vals[j]) for (k,j) in zip([4,2],[3,2])]
if layout is None: layout = (ceil(n_params/2),2)
if figsize is None: figsize = (12,2*n_params)
# make figure
i=0
# loop over every type of parameter
for n in range(n_param_classes):
if param_true is not None and len(param_means_list[n])>0:
order_map = bi_list_sort(param_means_list[n],param_true_list[n],ord_type='map')
param_true_reordered = [param_true_list[n][i] for i in order_map[1]]
# loop over the number of parameters in each class
for j in range(len(param_means_list[n])):
i+=1
ax = fig.add_subplot(layout[0],layout[1],i)
# Note: index is i-1 or n+j
idx = i-1 # or n+j (same thing)
# plot posterior (SMC) sample
if type == 'histogram':
if histogram == True: ax.hist(param_SMC[idx],bins=N_bins,density=True,color=color_vals[0],edgecolor=color_vals[0],alpha=alpha_vals[0])
if kde == True:
if histogram == False: sns.kdeplot(param_SMC[idx], color=color_vals[0], bw_method=0.25, clip =(min(param_SMC[idx]), max(param_SMC[idx])),shade=True)
elif histogram == True: sns.kdeplot(param_SMC[idx], color=color_vals[3], bw_method=0.25, clip =(min(param_SMC[idx]), max(param_SMC[idx])),shade=False)
elif type == 'scatterplot':
ax.scatter(np.arange(1,N_particles+1,1), param_SMC[idx], color=color_vals[0], marker='o', alpha=alpha_vals[0])
elif type == 'boxplot':
plt.boxplot([param_SMC[idx]])
plt.xticks([1], ['Filtered Particles'],size=12)
# plot the prior sample (optional)
if param_init is not None:
if type == 'histogram':
if histogram == True: ax.hist(param_init[idx],bins=N_bins,density=True,color=color_vals[1],edgecolor=color_vals[1],alpha=alpha_vals[1])
if kde == True: sns.kdeplot(param_init[idx], color=color_vals[1], bw_method=0.25, clip =(min(param_init[idx]), max(param_init[idx])),shade=True)
elif type == 'scatterplot':
ax.scatter(np.arange(1,N_particles+1,1), param_init[idx], color=color_vals[1], marker='o', alpha=alpha_vals[1])
elif type == 'boxplot':
plt.boxplot([param_SMC[idx],param_init[idx]])
plt.xticks([1, 2], ['Filtered Particles', 'Initial Particles'],size=12)
# plot the true parameters (optional)
if param_true is not None:
if type == 'histogram':
plt.axvline(x=param_true_reordered[j], color=color_vals[2], linestyle='--', alpha=alpha_vals[2])
elif type == 'scatterplot':
plt.axhline(y=param_true_reordered[j], color=color_vals[2], linestyle='--', alpha=alpha_vals[2])
elif type == 'boxplot':
plt.axhline(y=param_true_reordered[j], color=color_vals[2], linestyle='--',alpha=0.8,linewidth=0.8)
# legend, subplot titles and axis labels
if type == 'histogram' or type == 'scatterplot':
if param_init is not None or param_true is not None:
plt.legend(handles = col_legends, prop={'size': 8})
if type == 'boxplot':
if param_true is not None:
plt.legend(handles = col_legends_boxplot)
plt.title(param_names[idx],size=14)
if type == 'histogram':
plt.xlabel('Value',size=12)
plt.ylabel('Frequency',size=12)
elif type == 'scatterplot':
plt.xlabel('Particle',size=12)
plt.ylabel('Value',size=12)
elif type == 'boxplot':
plt.ylabel('Value',size=12)
if title == True:
if type == 'histogram': plt.suptitle('Parameter Distributions',size=16)
elif type == 'scatterplot': plt.suptitle('Particles Evolution',size=16)
elif type == 'boxplot': plt.suptitle('Parameter Box-Plot',size=16)
plt.tight_layout()
# summary statistics
def summary_table(param_names,param_SMC,param_true=None,print=False,save=False,save_name='table'):
summary_df = pd.DataFrame({'Parameter':param_names,
'Minimum':list(np.min(param_SMC,axis=1)),
'Maximum':list(np.max(param_SMC,axis=1)),
'Mean':list(np.mean(param_SMC,axis=1)),
'Median':list(np.median(param_SMC,axis=1)),
'Mode':[Counter(estimate).most_common(1)[0][0] for estimate in param_SMC]})
if param_true is not None:
# extract segmentation of parameters by type
# get mean of every parameter
param_means = [sum_stat(param,'mean') for param in param_SMC]
param_means_list = extract_parameters(param_means,Rp,Cp,Rq,Cq,k)
param_means_list[-1] = [param_means_list[-1]] # put sigma_epsilon square into its own list
# make list of segmentations for parameter means and true parameters
param_true_list = extract_parameters(param_true,Rp,Cp,Rq,Cq,k)
param_true_list[-1] = [param_true_list[-1]] # put sigma_epsilon square into its own list
assert np.array(param_means_list,dtype='object').shape == np.array(param_true_list,dtype='object').shape
param_true_reordered_list = param_true_list.copy()
n_params = param_SMC.shape[0] # Rp+2Cp+Rq+2Cq+2k+1
n_param_classes = len(param_means_list) # 1+2+1+2+2+1 = 9
for n in range(n_param_classes):
if param_true is not None and len(param_means_list[n])>0:
order_map = bi_list_sort(param_means_list[n],param_true_list[n],ord_type='map')
param_true_reordered_list[n] = [param_true_list[n][i] for i in order_map[1]]
param_true_reordered = list(itertools.chain.from_iterable(param_true_reordered_list))
summary_df['True Value'] = param_true_reordered
###############################################################################
summary_df.index = pd.RangeIndex(start=1, stop=len(param_names)+1, step=1)
summary_df = summary_df.round(3)
if print == True: display(Markdown(summary_df.to_markdown()))
if save == True:
summary_df = summary_df.style.format(decimal='.', thousands=',', precision=3)
with open(save_name+'.tex', 'w') as tf:
tf.write(summary_df.to_latex())
def post_process_smc(particles_init,particles_SMC,diagnostics_SMC,data,model_spec,
plot_init = True, param_true = None, S_true = None, stat = 'mean',
ESS = True, histogram = True, scatter = True, boxplot = True, table = True,
SDF = True, BIC = True, L2 = True, plot_settings = None,
save = False, display = True, plot_titles=False):
# 1. Read in data and model specification
f, Z = data
Rp, Cp, Rq, Cq, k = model_spec
ESS_vals = diagnostics_SMC['ESS']
resampling_iterations = diagnostics_SMC['resampling']
# Make arrays of particles and
param_init = np.array(particles_init) # initial particles
param_init = np.transpose(param_init)
param_SMC = np.array(particles_SMC) # particles following SMC
param_SMC = np.transpose(param_SMC)
N_particles = param_SMC.shape[1] # == len(particles_SMC)
n_params = param_SMC.shape[0] # == Rp+2*Cp+Rq+2*Cq+k
# 2. Create directory and save files there
model_name = 'GARMA_'+''.join(map(str, model_spec))
now = datetime.datetime.now() # current date and time
date_time = now.strftime("%m.%d.%Y_%Hh%Mm")
script_dir = os.path.dirname(os.getcwd())
results_dir = os.path.join(script_dir, model_name+'/')
if save == True:
if not os.path.isdir(results_dir):
os.makedirs(results_dir)
# 3. Save particles and diagnostics to folder
# particles
if save == True:
with open(results_dir+model_name+'_particles_init_'+date_time+'.txt', "w") as file:
for t in particles_init:
file.write(','.join(str(s) for s in t) + '\n')
with open(results_dir+model_name+'_particles_SMC_'+date_time+'.txt', "w") as file:
for t in particles_SMC:
file.write(','.join(str(s) for s in t) + '\n')
# to decode:
# with open('particles_SMC.txt') as txt_file:
# particles_SMC_good_run = [tuple(map(float, i.split(','))) for i in txt_file]
# diagnostics excluding weights
if save == True:
with open(results_dir+model_name+'_diagnostics_SMC_'+date_time+'.json', 'w') as file:
json.dump({key: diagnostics_SMC[key] for key in ('ESS', 'resampling', 'MCMC')}, file)
# to decode:
# with open('diagnostics_SMC.json') as json_file:
# data = json.load(json_file)
# 4. Extract the lists with each set of parameters and create the labels/names
param_SMC_list = extract_parameters(param_SMC,Rp,Cp,Rq,Cq,k,merged=False,display=False)
# AR
alpha1R_SMC = param_SMC_list[0]
alpha1R_names = [r'$\alpha_{{1{}}}^R$ (AR Real {})'.format(i+1,i+1) for i in range(len(alpha1R_SMC))]
alpha1C_SMC = param_SMC_list[1]
alpha1C_names = [r'$\alpha_{{1{}}}^C$ (AR Complex Modulus {})'.format(i+1,i+1) for i in range(len(alpha1C_SMC))]
omega1C_SMC = param_SMC_list[2]
omega1C_names = [r'$\omega_{{1{}}}^C$ (AR Complex Argument {})'.format(i+1,i+1) for i in range(len(omega1C_SMC))]
# MA
alpha2R_SMC = param_SMC_list[3]
alpha2R_names = [r'$\alpha_{{2{}}}^R$ (MA Real {})'.format(i+1,i+1) for i in range(len(alpha2R_SMC))]
alpha2C_SMC = param_SMC_list[4]
alpha2C_names = [r'$\alpha_{{2{}}}^C$ (MA Complex Modulus {})'.format(i+1,i+1) for i in range(len(alpha2C_SMC))]
omega2C_SMC = param_SMC_list[5]
omega2C_names = [r'$\omega_{{2{}}}^C$ (MA Complex Argument {})'.format(i+1,i+1) for i in range(len(omega2C_SMC))]
# Gegenbauer
lambda_SMC = param_SMC_list[6]
lambda_names = [r'$\lambda_{}$ (Gegenbauer {})'.format(i+1,i+1) for i in range(len(lambda_SMC))]
delta_SMC = param_SMC_list[7]
delta_names = [r'$\delta_{}$ (Gegenbauer memory {})'.format(i+1,i+1) for i in range(len(delta_SMC))]
# Variance
sigma_epsilon_SMC = param_SMC_list[8]
sigma_epsilon_name = [r'$\sigma_\epsilon^2$ (Innovation Variance)']
# make common list for all parameters
param_names = (alpha1R_names+alpha1C_names+omega1C_names+
alpha2R_names+alpha2C_names+omega2C_names+
lambda_names+delta_names+sigma_epsilon_name)
# 5. Extract the point estimates for the SDF plot using the summary statistic
alpha1R_est = [sum_stat(alpha1R,stat) for alpha1R in alpha1R_SMC]
alpha1C_est = [sum_stat(alpha1C,stat) for alpha1C in alpha1C_SMC]
alpha1_est = alpha1R_est + alpha1C_est
omega1R_est = [0]*Rp
omega1C_est = [sum_stat(omega1C,stat) for omega1C in omega1C_SMC]
omega1_est = omega1R_est + omega1C_est
alpha2R_est = [sum_stat(alpha2R,stat) for alpha2R in alpha2R_SMC]
alpha2C_est = [sum_stat(alpha2C,stat) for alpha2C in alpha2C_SMC]
alpha2_est = alpha2R_est + alpha2C_est
omega2R_est = [0]*Rq
omega2C_est = [sum_stat(omega2C,stat) for omega2C in omega2C_SMC]
omega2_est = omega2R_est + omega2C_est
lambda_est = [sum_stat(Lambda,stat) for Lambda in lambda_SMC]
delta_est = [sum_stat(delta,stat) for delta in delta_SMC]
sigma_epsilon_est = sum_stat(sigma_epsilon_SMC,stat) # 1
#param_est=alpha1_est+omega1_est+alpha2_est+omega2_est+lambda_est+delta_est+[sigma_epsilon_est]
param_est = alpha1R_est+alpha1C_est+omega1C_est+alpha2R_est+alpha2C_est+omega2C_est+lambda_est+delta_est+[sigma_epsilon_est]
# 6. Model fit – Maximum Likelihood and BIC
if BIC == True:
max_loglik = loglik(param_est,data,model_spec)
print('Maximized Loglikelihood: ',max_loglik)
bic = n_params*np.log(N_particles) - 2 * max_loglik
print('BIC: ',bic)
if param_true is not None:
true_max_loglik = loglik(param_true,data,model_spec)
print('True Maximum Loglikelihood: ',true_max_loglik)
best_bic = n_params*np.log(N_particles) - 2 * true_max_loglik
print('Best Achievable BIC: ',best_bic)
# save:
if param_true is not None:
summary_dict = {
'param_est': param_est,
'max_loglik': max_loglik,
'bic': bic,
'true_max_loglik': true_max_loglik,
'best_bic': best_bic,
'param_true': param_true }
else:
summary_dict = {
'param_est': param_est,
'max_loglik': max_loglik,
'bic': bic}
if save == True:
with open(results_dir+model_name+'_summary_bic_loglik_'+date_time+'.txt', 'w') as file:
w = csv.writer(file)
w.writerows(summary_dict.items())
# 7. Plots
# optional features for plots
if plot_settings is not None:
plot_features = plot_settings
else:
plot_features = {'ESS':{'n_frequency': 1, 'alpha': 0.5},
'metaplot': {'histogram': False, 'kde': True, 'layout': (5,2), 'figsize': (12,20)},
'SDF':{'with_peaks':True, 'with_periodogram': True, 'log_scale': True,'align_scale': False,'periodogram_display': 'line','high_res': True},
'variance':{'multiply': False, 'divide': False, 'times_variance': False}}
if ESS == True:
ESS_plot(N_particles,ESS_vals,resampling_iterations,
n_frequency=plot_features['ESS']['n_frequency'],alpha=plot_features['ESS']['alpha'],title=plot_titles)
if save == True: plt.savefig(results_dir + (model_name+'_ESS_plot_'+date_time+'.png'))
if display == True: plt.show()
if plot_init == False:
param_init = None # otherwise it stays as in step 1
if histogram == True:
meta_plot(model_spec,param_names,param_SMC,param_init,param_true,
histogram=plot_features['metaplot']['histogram'],kde=plot_features['metaplot']['kde'],title=plot_titles,
layout=plot_features['metaplot']['layout'],figsize=plot_features['metaplot']['figsize'],
type='histogram')
if save == True: plt.savefig(results_dir + (model_name+'_hist_plot_'+date_time+'.png'))
if display == True: plt.show()
if scatter == True:
meta_plot(model_spec,param_names,param_SMC,param_init,param_true,
histogram=plot_features['metaplot']['histogram'],kde=plot_features['metaplot']['kde'],title=plot_titles,
layout=plot_features['metaplot']['layout'],figsize=plot_features['metaplot']['figsize'],
type='scatterplot')
if save == True: plt.savefig(results_dir + (model_name+'_scatter_plot_'+date_time+'.png'))
if display == True: plt.show()
if boxplot == True:
meta_plot(model_spec,param_names,param_SMC,param_init,param_true,
histogram=plot_features['metaplot']['histogram'],kde=plot_features['metaplot']['kde'],title=plot_titles,
layout=plot_features['metaplot']['layout'],figsize=plot_features['metaplot']['figsize'],
type='boxplot')
if save == True: plt.savefig(results_dir + (model_name+'_box_plot_'+date_time+'.png'))
if display == True: plt.show()
if table == True:
summary_table(param_names,param_SMC,param_true,print=display,save=save,save_name=results_dir+(model_name+'_table_'+date_time))
if SDF == True:
# option to plot estimated SDF and true spectrum on high-res frequency grid to see poles
if plot_features['SDF']['high_res'] == True: f_SDF = np.linspace(min(f),max(f),100001)
else: f_SDF = f
S_Y_est = S_Y_vec(f_SDF,alpha1_est,omega1_est,alpha2_est,omega2_est,
lambda_est,delta_est,sigma_epsilon_est,p,q,k)
# option to also plot the periodogram
if plot_features['SDF']['with_periodogram'] == True: periodogram_vals = Z
else: periodogram_vals = None
# scaling if sigma_epsilon not estimated
if plot_features['variance']['multiply'] == True:
S_Y_est = sigma_epsilon_est*S_Y_est
if plot_features['variance']['divide'] == True:
S_Y_est = 1/sigma_epsilon_est*S_Y_est
if plot_features['variance']['times_variance'] == True:
S_Y_est = np.var(y)*S_Y_est
# L2-norm of difference between the estimated and true SDF
if L2 == True and S_true is not None and len(S_true)==len(S_Y_est):
print('L2 norm of Spectral Error: ',sum((S_Y_est-S_true)**2))
# PLOT the SDF (plus optionally the periodogram and true spectrum, if available)
plot_SDF(f,S_Y_est,periodogram_vals=periodogram_vals,true_vals=S_true,with_peaks=plot_features['SDF']['with_peaks'],
Lambda=lambda_est,alpha1C=alpha1C_est,omega1C=omega1C_est,
log=plot_features['SDF']['log_scale'],title='',align_scale=plot_features['SDF']['align_scale'],periodogram_display=plot_features['SDF']['periodogram_display'])
if save == True: plt.savefig(results_dir + (model_name+'_SDF_plot_'+date_time+'.png'))
if display == True: plt.show()
# saving and opening json files
# with open('diagnostics_SMC.json', 'w') as fp:
# json.dump({k: diagnostics_SMC[k] for k in ('ESS', 'resampling', 'MCMC', 'loglik', 'marginal_lik')}, fp)
# with open('diagnostics_SMC.json') as json_file:
# data = json.load(json_file)
# Choose the Data
f, Z = S_p_vec(y,tapered=True,taper='hann')
data = (f,Z)
######################################################################
# Model Selection
Rp=1 # number of real AR roots
Cp=0 # number of complex AR roots
# MA(q) model specification
Rq=1 # number of real MA roots
Cq=1 # number of complex MA roots
# Gegenbauer(k) model specification
k=2 # number of Gegenbauer factors
######################################################################
# Define the vector of model specifications
model_spec = (Rp,Cp,Rq,Cq,k)
# Set the lower and upper bounds for the given model
lb_param, ub_param = set_bounds(Rp,Cp,Rq,Cq,k)
# Calculate the number of parameters to estimate
p=Rp+2*Cp
q=Rq+2*Cq
nparam = Rp+2*Cp+Rq+2*Cq+2*k+1
print("Model specified: GARMA (",p,",",k,",",q,")", "\n")
print("Number of parameters to estimate: ",nparam, "\n")
Model specified: GARMA ( 1 , 2 , 3 ) Number of parameters to estimate: 9
# Specify the prior on sigma_epsilon
sigma_prior, sigma_shape, sigma_scale = 'invgamma', 1, 1
#sigma_prior, sigma_mean, sigma_std = 'truncnormal', np.var(y)/2, np.var(y)
#sigma_prior, sigma_mean, sigma_std = 'truncnormal', 1, 0.001
#sigma_prior, sigma_lb, sigma_ub = 'uniform', 0, 5
######################################################################
# Initialize the particles
N_particles = 1000
particles_init = initialize_particles(N_particles,model_spec,sigma_prior, sigma_shape, sigma_scale)
# inspect particles
particles_init[:5]
[(0.023470313739167525, 0.7151501224099388, 0.3503900062099622, 0.2630152268924289, 0.44319004531117323, 0.19335361129726625, 0.0013413908740459446, 0.4864536857634609, 1.4585512976400536), (0.3339413157900063, 0.9245386392778936, 0.8835718134326798, 0.4172327016945956, 0.9924092332844319, 0.06651224380383569, 0.25595149685803553, 0.03426455910828452, 0.8801648873642917), (0.3181539504143551, 0.8312770997877519, 0.20285533658629062, 0.0962201906358312, 0.4422108783876719, -0.07908079047706607, 0.43851835736477274, 0.10459367561079258, 2.35454023448103), (0.5735822802736481, 0.6318292907071795, 0.6740259368605029, 0.17824546993233575, 0.7854221258226326, -0.14729674879942145, 0.4922969753227438, 0.21355444265307705, 0.31567964154947814), (0.47230546727416556, 0.6024992162542213, 0.9923649301466576, 0.4796333128866875, -0.4031872431723218, 0.3389369332972796, 0.18569392844046118, 0.3009691727773325, 1.3058988690219737)]
# proposal variance (fraction of parameter range, absolute value for variance)
proposal_variance = (0.4,1) #(0.4,1) #(1/4, 0.5) #(1/2, 1)
# number of bridges and MCMC updates for each bridging distribution
N_iterations = 100 #20 #50 #60
N_MCMC_updates = 5 #2 #25 #30
# ESS resampling threshold (fraction between 0 and 1 of number of particles)
threshold = 0.5 #0.7
# AIS bridging densities spacing type
spacing_type = 'linear' #'geometric'
particles_SMC_cpi_garma_00002_tapered, diagnostics_SMC_cpi_garma_00002_tapered = smc_sampler_pro(particles_init, lb_param, ub_param,
data, model_spec,
sigma_prior, sigma_shape, sigma_scale,
delta = proposal_variance, N_bridges = N_iterations, N_updates = N_MCMC_updates,
spacing = spacing_type, resampling = True, MCMC = True, alpha=threshold,
loglik_scaling = False, verbose = True, print_diagnostic = True)
Iteration 1 out of 101:
ESS = 634.14
Time spent on iteration: 0.1s (Total time: 0.1s)
Iteration 2 out of 101:
Scaling_factor: 1 Logprior: -4.1498345548030695 Loglik: -615.3009507280478 L_W_old: -4.1498345548030695 L_W_new: -10.302844062083548 exp(L_W_new-L_W_old): 0.002127070693048282 weight: 1.3372881241803665e-07 sigma_epsilon: 7.446719642533509
ESS = 314.09
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 487.3s (Total time: 487.4s)
Iteration 3 out of 101:
Scaling_factor: 1 Logprior: -0.8380853097483179 Loglik: -522.6758658048842 L_W_old: -6.06484396779716 L_W_new: -11.291602625846002 exp(L_W_new-L_W_old): 0.005370906062085056 weight: 5.3709060620850555e-06 sigma_epsilon: 0.8361730436741748
ESS = 832.55
Time spent on iteration: 20.6s (Total time: 507.9s)
Iteration 4 out of 101:
Scaling_factor: 1 Logprior: -0.8380853097483179 Loglik: -522.6758658048842 L_W_old: -11.291602625846002 L_W_new: -16.518361283894844 exp(L_W_new-L_W_old): 0.005370906062085051 weight: 2.2740624105715158e-06 sigma_epsilon: 0.8361730436741748
ESS = 645.05
Time spent on iteration: 19.8s (Total time: 527.7s)
Iteration 5 out of 101:
Scaling_factor: 1 Logprior: -0.8380853097483179 Loglik: -522.6758658048842 L_W_old: -16.518361283894844 L_W_new: -21.74511994194369 exp(L_W_new-L_W_old): 0.005370906062085041 weight: 8.016213244417076e-07 sigma_epsilon: 0.8361730436741748
ESS = 504.84
Time spent on iteration: 18.6s (Total time: 546.4s)
Iteration 6 out of 101:
Scaling_factor: 1 Logprior: -0.8380853097483179 Loglik: -522.6758658048842 L_W_old: -21.74511994194369 L_W_new: -26.971878599992532 exp(L_W_new-L_W_old): 0.005370906062085041 weight: 2.5654861567607354e-07 sigma_epsilon: 0.8361730436741748
ESS = 400.89
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 477.2s (Total time: 1023.6s)
Iteration 7 out of 101:
Scaling_factor: 1 Logprior: -2.7203924544653715 Loglik: -426.51910922548507 L_W_old: -24.046347915739627 L_W_new: -28.311539007994476 exp(L_W_new-L_W_old): 0.014049182186615147 weight: 1.4049182186615148e-05 sigma_epsilon: 3.357812653153018
ESS = 963.57
Time spent on iteration: 19.5s (Total time: 1043.1s)
Iteration 8 out of 101:
Scaling_factor: 1 Logprior: -2.7203924544653715 Loglik: -426.51910922548507 L_W_old: -28.311539007994476 L_W_new: -32.57673010024933 exp(L_W_new-L_W_old): 0.014049182186615097 weight: 1.0519218949623047e-05 sigma_epsilon: 3.357812653153018
ESS = 885.45
Time spent on iteration: 19.0s (Total time: 1062.1s)
Iteration 9 out of 101:
Scaling_factor: 1 Logprior: -2.7203924544653715 Loglik: -426.51910922548507 L_W_old: -32.57673010024933 L_W_new: -36.841921192504174 exp(L_W_new-L_W_old): 0.014049182186615198 weight: 7.589244136362685e-06 sigma_epsilon: 3.357812653153018
ESS = 789.93
Time spent on iteration: 17.9s (Total time: 1080.0s)
Iteration 10 out of 101:
Scaling_factor: 1 Logprior: -2.7203924544653715 Loglik: -426.51910922548507 L_W_old: -36.841921192504174 L_W_new: -41.107112284759026 exp(L_W_new-L_W_old): 0.014049182186615097 weight: 5.315115731700255e-06 sigma_epsilon: 3.357812653153018
ESS = 688.80
Time spent on iteration: 17.9s (Total time: 1098.0s)
Iteration 11 out of 101:
Scaling_factor: 1 Logprior: -2.7203924544653715 Loglik: -426.51910922548507 L_W_old: -41.107112284759026 L_W_new: -45.37230337701388 exp(L_W_new-L_W_old): 0.014049182186615097 weight: 3.6300449665762694e-06 sigma_epsilon: 3.357812653153018
ESS = 588.93
Time spent on iteration: 17.9s (Total time: 1115.9s)
Iteration 12 out of 101:
Scaling_factor: 1 Logprior: -2.7203924544653715 Loglik: -426.51910922548507 L_W_old: -45.37230337701388 L_W_new: -49.637494469268724 exp(L_W_new-L_W_old): 0.014049182186615198 weight: 2.425170512670875e-06 sigma_epsilon: 3.357812653153018
ESS = 494.86
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 470.9s (Total time: 1586.7s)
Iteration 13 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -45.00434289834092 L_W_new: -48.94725003335695 exp(L_W_new-L_W_old): 0.01939175826237068 weight: 1.939175826237068e-05 sigma_epsilon: 1.6794484058491872
ESS = 983.25
Time spent on iteration: 19.1s (Total time: 1605.8s)
Iteration 14 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -48.94725003335695 L_W_new: -52.890157168372994 exp(L_W_new-L_W_old): 0.019391758262370405 weight: 1.7247376588314822e-05 sigma_epsilon: 1.6794484058491872
ESS = 937.60
Time spent on iteration: 18.3s (Total time: 1624.1s)
Iteration 15 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -52.890157168372994 L_W_new: -56.83306430338903 exp(L_W_new-L_W_old): 0.01939175826237054 weight: 1.5083103979021847e-05 sigma_epsilon: 1.6794484058491872
ESS = 870.84
Time spent on iteration: 19.5s (Total time: 1643.6s)
Iteration 16 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -56.83306430338903 L_W_new: -60.77597143840506 exp(L_W_new-L_W_old): 0.01939175826237068 weight: 1.297981746839225e-05 sigma_epsilon: 1.6794484058491872
ESS = 791.17
Time spent on iteration: 18.6s (Total time: 1662.3s)
Iteration 17 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -60.77597143840506 L_W_new: -64.7188785734211 exp(L_W_new-L_W_old): 0.01939175826237054 weight: 1.0999690636263484e-05 sigma_epsilon: 1.6794484058491872
ESS = 706.16
Time spent on iteration: 18.4s (Total time: 1680.7s)
Iteration 18 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -64.7188785734211 L_W_new: -68.66178570843712 exp(L_W_new-L_W_old): 0.01939175826237068 weight: 9.186276555787756e-06 sigma_epsilon: 1.6794484058491872
ESS = 621.92
Time spent on iteration: 18.2s (Total time: 1698.9s)
Iteration 19 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -68.66178570843712 L_W_new: -72.60469284345315 exp(L_W_new-L_W_old): 0.01939175826237068 weight: 7.565822178158757e-06 sigma_epsilon: 1.6794484058491872
ESS = 542.69
Time spent on iteration: 18.1s (Total time: 1717.0s)
Iteration 20 out of 101:
Scaling_factor: 1 Logprior: -1.632364413164543 Loglik: -394.2907135016034 L_W_old: -72.60469284345315 L_W_new: -76.5475999784692 exp(L_W_new-L_W_old): 0.019391758262370405 weight: 6.149531301158092e-06 sigma_epsilon: 1.6794484058491872
ESS = 470.94
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 488.9s (Total time: 2205.9s)
Iteration 21 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -74.12705528178842 L_W_new: -77.94257424896894 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 2.2026280570271445e-05 sigma_epsilon: 1.679245731402381
ESS = 988.50
Time spent on iteration: 18.6s (Total time: 2224.5s)
Iteration 22 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -77.94257424896894 L_W_new: -81.75809321614946 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 1.9895650074358867e-05 sigma_epsilon: 1.679245731402381
ESS = 957.63
Time spent on iteration: 19.5s (Total time: 2244.0s)
Iteration 23 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -81.75809321614946 L_W_new: -85.57361218332998 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 1.7764387889893428e-05 sigma_epsilon: 1.679245731402381
ESS = 913.02
Time spent on iteration: 19.3s (Total time: 2263.3s)
Iteration 24 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -85.57361218332998 L_W_new: -89.38913115051051 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 1.5690804136579743e-05 sigma_epsilon: 1.679245731402381
ESS = 859.86
Time spent on iteration: 19.2s (Total time: 2282.5s)
Iteration 25 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -89.38913115051051 L_W_new: -93.20465011769103 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 1.3720108983949077e-05 sigma_epsilon: 1.679245731402381
ESS = 802.47
Time spent on iteration: 19.4s (Total time: 2301.8s)
Iteration 26 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -93.20465011769103 L_W_new: -97.02016908487155 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 1.1884722366570015e-05 sigma_epsilon: 1.679245731402381
ESS = 744.04
Time spent on iteration: 20.7s (Total time: 2322.6s)
Iteration 27 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -97.02016908487155 L_W_new: -100.83568805205208 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 1.0205344213869323e-05 sigma_epsilon: 1.679245731402381
ESS = 686.74
Time spent on iteration: 20.3s (Total time: 2342.8s)
Iteration 28 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -100.83568805205208 L_W_new: -104.65120701923261 exp(L_W_new-L_W_old): 0.02202628057027113 weight: 8.692534830631994e-06 sigma_epsilon: 1.679245731402381
ESS = 631.87
Time spent on iteration: 19.8s (Total time: 2362.6s)
Iteration 29 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -104.65120701923261 L_W_new: -108.46672598641314 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 7.348557875600326e-06 sigma_epsilon: 1.679245731402381
ESS = 580.11
Time spent on iteration: 19.9s (Total time: 2382.5s)
Iteration 30 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -108.46672598641314 L_W_new: -112.28224495359365 exp(L_W_new-L_W_old): 0.022026280570271756 weight: 6.169274008938494e-06 sigma_epsilon: 1.679245731402381
ESS = 531.69
Time spent on iteration: 19.0s (Total time: 2401.5s)
Iteration 31 out of 101:
Scaling_factor: 1 Logprior: -1.6321949053584637 Loglik: -381.5518967180524 L_W_old: -112.28224495359365 L_W_new: -116.09776392077417 exp(L_W_new-L_W_old): 0.022026280570271443 weight: 5.1459260933188705e-06 sigma_epsilon: 1.679245731402381
ESS = 486.57
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 488.3s (Total time: 2889.8s)
Iteration 32 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -109.45695514578084 L_W_new: -113.0590991491725 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.7265203049003647e-05 sigma_epsilon: 1.405890800161155
ESS = 995.14
Time spent on iteration: 21.2s (Total time: 2911.1s)
Iteration 33 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -113.0590991491725 L_W_new: -116.66124315256414 exp(L_W_new-L_W_old): 0.027265203049004035 weight: 2.7759470733011174e-05 sigma_epsilon: 1.405890800161155
ESS = 981.42
Time spent on iteration: 19.2s (Total time: 2930.2s)
Iteration 34 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -116.66124315256414 L_W_new: -120.2633871559558 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.8125266876365336e-05 sigma_epsilon: 1.405890800161155
ESS = 960.08
Time spent on iteration: 19.3s (Total time: 2949.5s)
Iteration 35 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -120.2633871559558 L_W_new: -123.86553115934746 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.836273668820529e-05 sigma_epsilon: 1.405890800161155
ESS = 932.25
Time spent on iteration: 19.0s (Total time: 2968.5s)
Iteration 36 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -123.86553115934746 L_W_new: -127.46767516273911 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.8473403559609063e-05 sigma_epsilon: 1.405890800161155
ESS = 898.96
Time spent on iteration: 19.1s (Total time: 2987.6s)
Iteration 37 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -127.46767516273911 L_W_new: -131.06981916613077 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.8460063110040626e-05 sigma_epsilon: 1.405890800161155
ESS = 861.15
Time spent on iteration: 19.6s (Total time: 3007.1s)
Iteration 38 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -131.06981916613077 L_W_new: -134.67196316952243 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.8326669791790844e-05 sigma_epsilon: 1.405890800161155
ESS = 819.69
Time spent on iteration: 19.0s (Total time: 3026.1s)
Iteration 39 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -134.67196316952243 L_W_new: -138.27410717291406 exp(L_W_new-L_W_old): 0.02726520304900442 weight: 2.807821975953718e-05 sigma_epsilon: 1.405890800161155
ESS = 775.44
Time spent on iteration: 19.0s (Total time: 3045.1s)
Iteration 40 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -138.27410717291406 L_W_new: -141.87625117630571 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.7720632708564576e-05 sigma_epsilon: 1.405890800161155
ESS = 729.18
Time spent on iteration: 19.2s (Total time: 3064.3s)
Iteration 41 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -141.87625117630571 L_W_new: -145.47839517969737 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.7260634413862186e-05 sigma_epsilon: 1.405890800161155
ESS = 681.72
Time spent on iteration: 18.8s (Total time: 3083.2s)
Iteration 42 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -145.47839517969737 L_W_new: -149.08053918308903 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.6705640869961987e-05 sigma_epsilon: 1.405890800161155
ESS = 633.82
Time spent on iteration: 18.9s (Total time: 3102.0s)
Iteration 43 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -149.08053918308903 L_W_new: -152.6826831864807 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.606364429954947e-05 sigma_epsilon: 1.405890800161155
ESS = 586.20
Time spent on iteration: 19.2s (Total time: 3121.3s)
Iteration 44 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -152.6826831864807 L_W_new: -156.28482718987235 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.5343100892329072e-05 sigma_epsilon: 1.405890800161155
ESS = 539.54
Time spent on iteration: 18.9s (Total time: 3140.2s)
Iteration 45 out of 101:
Scaling_factor: 1 Logprior: -1.3926350440312032 Loglik: -360.2144003391654 L_W_old: -156.28482718987235 L_W_new: -159.886971193264 exp(L_W_new-L_W_old): 0.027265203049003647 weight: 2.4552819952078428e-05 sigma_epsilon: 1.405890800161155
ESS = 494.42
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 484.2s (Total time: 3624.4s)
Iteration 46 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -158.08067265756367 L_W_new: -161.63709647294877 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.854070927200297e-05 sigma_epsilon: 1.6386746102961278
ESS = 996.41
Time spent on iteration: 19.7s (Total time: 3644.1s)
Iteration 47 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -161.63709647294877 L_W_new: -165.19352028833384 exp(L_W_new-L_W_old): 0.02854070927200378 weight: 2.8659329309988866e-05 sigma_epsilon: 1.6386746102961278
ESS = 986.06
Time spent on iteration: 19.2s (Total time: 3663.3s)
Iteration 48 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -165.19352028833384 L_W_new: -168.74994410371895 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.8675117537192113e-05 sigma_epsilon: 1.6386746102961278
ESS = 969.63
Time spent on iteration: 19.3s (Total time: 3682.7s)
Iteration 49 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -168.74994410371895 L_W_new: -172.30636791910402 exp(L_W_new-L_W_old): 0.02854070927200378 weight: 2.8590425490406264e-05 sigma_epsilon: 1.6386746102961278
ESS = 947.87
Time spent on iteration: 19.2s (Total time: 3701.9s)
Iteration 50 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -172.30636791910402 L_W_new: -175.86279173448912 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.8408527697384707e-05 sigma_epsilon: 1.6386746102961278
ESS = 921.59
Time spent on iteration: 19.2s (Total time: 3721.1s)
Iteration 51 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -175.86279173448912 L_W_new: -179.41921554987422 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.8133562647504837e-05 sigma_epsilon: 1.6386746102961278
ESS = 891.61
Time spent on iteration: 19.4s (Total time: 3740.5s)
Iteration 52 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -179.41921554987422 L_W_new: -182.97563936525933 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.777045871277501e-05 sigma_epsilon: 1.6386746102961278
ESS = 858.78
Time spent on iteration: 19.1s (Total time: 3759.6s)
Iteration 53 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -182.97563936525933 L_W_new: -186.53206318064443 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.732484626401211e-05 sigma_epsilon: 1.6386746102961278
ESS = 823.92
Time spent on iteration: 18.8s (Total time: 3778.5s)
Iteration 54 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -186.53206318064443 L_W_new: -190.0884869960295 exp(L_W_new-L_W_old): 0.02854070927200378 weight: 2.6802957924612285e-05 sigma_epsilon: 1.6386746102961278
ESS = 787.79
Time spent on iteration: 19.1s (Total time: 3797.6s)
Iteration 55 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -190.0884869960295 L_W_new: -193.6449108114146 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.6211519484347575e-05 sigma_epsilon: 1.6386746102961278
ESS = 751.10
Time spent on iteration: 20.0s (Total time: 3817.5s)
Iteration 56 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -193.6449108114146 L_W_new: -197.2013346267997 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.5557634426223202e-05 sigma_epsilon: 1.6386746102961278
ESS = 714.43
Time spent on iteration: 19.2s (Total time: 3836.7s)
Iteration 57 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -197.2013346267997 L_W_new: -200.7577584421848 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.4848665279396466e-05 sigma_epsilon: 1.6386746102961278
ESS = 678.31
Time spent on iteration: 19.4s (Total time: 3856.1s)
Iteration 58 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -200.7577584421848 L_W_new: -204.3141822575699 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.409211509171086e-05 sigma_epsilon: 1.6386746102961278
ESS = 643.12
Time spent on iteration: 18.9s (Total time: 3875.0s)
Iteration 59 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -204.3141822575699 L_W_new: -207.87060607295496 exp(L_W_new-L_W_old): 0.02854070927200459 weight: 2.329551222050599e-05 sigma_epsilon: 1.6386746102961278
ESS = 609.18
Time spent on iteration: 19.5s (Total time: 3894.4s)
Iteration 60 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -207.87060607295496 L_W_new: -211.42702988834006 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.2466301386331722e-05 sigma_epsilon: 1.6386746102961278
ESS = 576.72
Time spent on iteration: 19.3s (Total time: 3913.7s)
Iteration 61 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -211.42702988834006 L_W_new: -214.98345370372516 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.161174354756594e-05 sigma_epsilon: 1.6386746102961278
ESS = 545.87
Time spent on iteration: 19.3s (Total time: 3933.0s)
Iteration 62 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -214.98345370372516 L_W_new: -218.53987751911026 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 2.0738826668442267e-05 sigma_epsilon: 1.6386746102961278
ESS = 516.71
Time spent on iteration: 19.2s (Total time: 3952.1s)
Iteration 63 out of 101:
Scaling_factor: 1 Logprior: -1.5980247806195231 Loglik: -355.6423815385094 L_W_old: -218.53987751911026 L_W_new: -222.09630133449537 exp(L_W_new-L_W_old): 0.02854070927200297 weight: 1.985418890666985e-05 sigma_epsilon: 1.6386746102961278
ESS = 489.29
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 490.7s (Total time: 4442.8s)
Iteration 64 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -221.25398808867646 L_W_new: -224.7960949673724 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.8952263870447407e-05 sigma_epsilon: 1.692627566396072
ESS = 997.94
Time spent on iteration: 22.1s (Total time: 4464.9s)
Iteration 65 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -224.7960949673724 L_W_new: -228.33820184606833 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.7957307710467746e-05 sigma_epsilon: 1.692627566396072
ESS = 992.11
Time spent on iteration: 22.2s (Total time: 4487.2s)
Iteration 66 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -228.33820184606833 L_W_new: -231.88030872476426 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.6940800426264108e-05 sigma_epsilon: 1.692627566396072
ESS = 983.09
Time spent on iteration: 19.8s (Total time: 4507.0s)
Iteration 67 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -231.88030872476426 L_W_new: -235.4224156034602 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.5909920289561976e-05 sigma_epsilon: 1.692627566396072
ESS = 971.39
Time spent on iteration: 18.9s (Total time: 4525.9s)
Iteration 68 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -235.4224156034602 L_W_new: -238.96452248215613 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.4871339433933285e-05 sigma_epsilon: 1.692627566396072
ESS = 957.53
Time spent on iteration: 19.7s (Total time: 4545.6s)
Iteration 69 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -238.96452248215613 L_W_new: -242.50662936085206 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.3831193727560296e-05 sigma_epsilon: 1.692627566396072
ESS = 941.97
Time spent on iteration: 20.9s (Total time: 4566.5s)
Iteration 70 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -242.50662936085206 L_W_new: -246.048736239548 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.2795065183454945e-05 sigma_epsilon: 1.692627566396072
ESS = 925.10
Time spent on iteration: 21.7s (Total time: 4588.3s)
Iteration 71 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -246.048736239548 L_W_new: -249.59084311824392 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 2.1767975570402074e-05 sigma_epsilon: 1.692627566396072
ESS = 907.29
Time spent on iteration: 20.0s (Total time: 4608.3s)
Iteration 72 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -249.59084311824392 L_W_new: -253.1329499969398 exp(L_W_new-L_W_old): 0.028952263870449052 weight: 2.0754389798257167e-05 sigma_epsilon: 1.692627566396072
ESS = 888.84
Time spent on iteration: 19.5s (Total time: 4627.8s)
Iteration 73 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -253.1329499969398 L_W_new: -256.67505687563573 exp(L_W_new-L_W_old): 0.028952263870447408 weight: 1.9758227619793347e-05 sigma_epsilon: 1.692627566396072
ESS = 870.01
Time spent on iteration: 19.8s (Total time: 4647.6s)
Iteration 74 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -256.67505687563573 L_W_new: -260.2171637543317 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 1.8782882209678774e-05 sigma_epsilon: 1.692627566396072
ESS = 851.01
Time spent on iteration: 23.1s (Total time: 4670.7s)
Iteration 75 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -260.2171637543317 L_W_new: -263.7592706330276 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 1.7831244240055937e-05 sigma_epsilon: 1.692627566396072
ESS = 832.01
Time spent on iteration: 22.2s (Total time: 4692.9s)
Iteration 76 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -263.7592706330276 L_W_new: -267.30137751172356 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 1.690573016244748e-05 sigma_epsilon: 1.692627566396072
ESS = 813.15
Time spent on iteration: 19.9s (Total time: 4712.8s)
Iteration 77 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -267.30137751172356 L_W_new: -270.84348439041946 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 1.600831351820429e-05 sigma_epsilon: 1.692627566396072
ESS = 794.53
Time spent on iteration: 19.6s (Total time: 4732.4s)
Iteration 78 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -270.84348439041946 L_W_new: -274.3855912691154 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 1.5140558226325513e-05 sigma_epsilon: 1.692627566396072
ESS = 776.23
Time spent on iteration: 20.0s (Total time: 4752.4s)
Iteration 79 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -274.3855912691154 L_W_new: -277.9276981478113 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 1.4303652931166807e-05 sigma_epsilon: 1.692627566396072
ESS = 758.32
Time spent on iteration: 20.6s (Total time: 4773.1s)
Iteration 80 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -277.9276981478113 L_W_new: -281.4698050265073 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 1.3498445627148907e-05 sigma_epsilon: 1.692627566396072
ESS = 740.83
Time spent on iteration: 22.8s (Total time: 4795.9s)
Iteration 81 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -281.4698050265073 L_W_new: -285.0119119052032 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 1.2725477908556673e-05 sigma_epsilon: 1.692627566396072
ESS = 723.79
Time spent on iteration: 22.8s (Total time: 4818.7s)
Iteration 82 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -285.0119119052032 L_W_new: -288.55401878389915 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 1.198501831605843e-05 sigma_epsilon: 1.692627566396072
ESS = 707.21
Time spent on iteration: 23.0s (Total time: 4841.7s)
Iteration 83 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -288.55401878389915 L_W_new: -292.09612566259506 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 1.1277094365382542e-05 sigma_epsilon: 1.692627566396072
ESS = 691.11
Time spent on iteration: 20.4s (Total time: 4862.1s)
Iteration 84 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -292.09612566259506 L_W_new: -295.638232541291 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 1.0601522945874947e-05 sigma_epsilon: 1.692627566396072
ESS = 675.48
Time spent on iteration: 20.4s (Total time: 4882.6s)
Iteration 85 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -295.638232541291 L_W_new: -299.1803394199869 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 9.957938866839734e-06 sigma_epsilon: 1.692627566396072
ESS = 660.32
Time spent on iteration: 20.5s (Total time: 4903.1s)
Iteration 86 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -299.1803394199869 L_W_new: -302.7224462986828 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 9.345821407282205e-06 sigma_epsilon: 1.692627566396072
ESS = 645.61
Time spent on iteration: 20.4s (Total time: 4923.5s)
Iteration 87 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -302.7224462986828 L_W_new: -306.2645531773788 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 8.764518790449876e-06 sigma_epsilon: 1.692627566396072
ESS = 631.35
Time spent on iteration: 19.8s (Total time: 4943.3s)
Iteration 88 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -306.2645531773788 L_W_new: -309.8066600560747 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 8.213270558911493e-06 sigma_epsilon: 1.692627566396072
ESS = 617.52
Time spent on iteration: 19.5s (Total time: 4962.8s)
Iteration 89 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -309.8066600560747 L_W_new: -313.34876693477065 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 7.691227869877091e-06 sigma_epsilon: 1.692627566396072
ESS = 604.10
Time spent on iteration: 20.7s (Total time: 4983.4s)
Iteration 90 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -313.34876693477065 L_W_new: -316.89087381346656 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 7.1974717650303315e-06 sigma_epsilon: 1.692627566396072
ESS = 591.07
Time spent on iteration: 20.4s (Total time: 5003.8s)
Iteration 91 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -316.89087381346656 L_W_new: -320.4329806921625 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 6.731029495435086e-06 sigma_epsilon: 1.692627566396072
ESS = 578.42
Time spent on iteration: 21.7s (Total time: 5025.5s)
Iteration 92 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -320.4329806921625 L_W_new: -323.9750875708584 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 6.290889001274659e-06 sigma_epsilon: 1.692627566396072
ESS = 566.13
Time spent on iteration: 20.5s (Total time: 5046.0s)
Iteration 93 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -323.9750875708584 L_W_new: -327.5171944495544 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 5.8760116592686265e-06 sigma_epsilon: 1.692627566396072
ESS = 554.19
Time spent on iteration: 20.1s (Total time: 5066.1s)
Iteration 94 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -327.5171944495544 L_W_new: -331.0593013282503 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 5.485343418708998e-06 sigma_epsilon: 1.692627566396072
ESS = 542.57
Time spent on iteration: 19.2s (Total time: 5085.3s)
Iteration 95 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -331.0593013282503 L_W_new: -334.60140820694625 exp(L_W_new-L_W_old): 0.028952263870446582 weight: 5.117824450974364e-06 sigma_epsilon: 1.692627566396072
ESS = 531.26
Time spent on iteration: 21.2s (Total time: 5106.4s)
Iteration 96 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -334.60140820694625 L_W_new: -338.14351508564215 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 4.772397438047126e-06 sigma_epsilon: 1.692627566396072
ESS = 520.25
Time spent on iteration: 19.7s (Total time: 5126.1s)
Iteration 97 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -338.14351508564215 L_W_new: -341.68562196433805 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 4.4480146235959984e-06 sigma_epsilon: 1.692627566396072
ESS = 509.51
Time spent on iteration: 19.2s (Total time: 5145.3s)
Iteration 98 out of 101:
Scaling_factor: 1 Logprior: -1.6433616095288293 Loglik: -354.21068786959296 L_W_old: -341.68562196433805 L_W_new: -345.22772884303396 exp(L_W_new-L_W_old): 0.02895226387044823 weight: 4.143643746302113e-06 sigma_epsilon: 1.692627566396072
ESS = 499.04
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 512.0s (Total time: 5657.3s)
Iteration 99 out of 101:
Scaling_factor: 1 Logprior: -1.4974948723035075 Loglik: -348.84362467790703 L_W_old: -339.8758108098733 L_W_new: -343.3642470566524 exp(L_W_new-L_W_old): 0.030548605320021533 weight: 3.054860532002153e-05 sigma_epsilon: 1.5224693743434625
ESS = 999.58
Time spent on iteration: 21.5s (Total time: 5678.8s)
Iteration 100 out of 101:
Scaling_factor: 1 Logprior: -1.4974948723035075 Loglik: -348.84362467790703 L_W_old: -343.3642470566524 L_W_new: -346.85268330343143 exp(L_W_new-L_W_old): 0.030548605320023268 weight: 2.99862389186149e-05 sigma_epsilon: 1.5224693743434625
ESS = 998.37
Time spent on iteration: 20.1s (Total time: 5698.8s)
Iteration 101 out of 101:
Scaling_factor: 1 Logprior: -1.4974948723035075 Loglik: -348.84362467790703 L_W_old: -346.85268330343143 L_W_new: -350.3411195502105 exp(L_W_new-L_W_old): 0.030548605320021533 weight: 2.9421773813849154e-05 sigma_epsilon: 1.5224693743434625
ESS = 996.44
Final Resampling
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 496.1s (Total time: 6194.9s)
particles_SMC_cpi_garma_00003_tapered, diagnostics_SMC_cpi_garma_00003_tapered = smc_sampler_pro(particles_init, lb_param, ub_param,
data, model_spec,
sigma_prior, sigma_shape, sigma_scale,
delta = proposal_variance, N_bridges = N_iterations, N_updates = N_MCMC_updates,
spacing = spacing_type, resampling = True, MCMC = True, alpha=threshold,
loglik_scaling = False, verbose = True, print_diagnostic = True)
Iteration 1 out of 101:
ESS = 651.40
Time spent on iteration: 0.1s (Total time: 0.1s)
Iteration 2 out of 101:
Scaling_factor: 1 Logprior: -1.4030715055031635 Loglik: -3575.5650668301655 L_W_old: -1.4030715055031635 L_W_new: -37.15872217380482 exp(L_W_new-L_W_old): 2.961544194403907e-16 weight: 2.86470374081875e-19 sigma_epsilon: 0.23053100240934318
ESS = 280.59
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 706.9s (Total time: 706.9s)
Iteration 3 out of 101:
Scaling_factor: 1 Logprior: -1.8256184576602341 Loglik: -393.862312977174 L_W_old: -5.7642415874319735 L_W_new: -9.702864717203713 exp(L_W_new-L_W_old): 0.0194750108564116 weight: 1.94750108564116e-05 sigma_epsilon: 1.9201749173751685
ESS = 819.48
Time spent on iteration: 19.8s (Total time: 726.7s)
Iteration 4 out of 101:
Scaling_factor: 1 Logprior: -1.8256184576602341 Loglik: -393.862312977174 L_W_old: -9.702864717203713 L_W_new: -13.641487846975453 exp(L_W_new-L_W_old): 0.0194750108564116 weight: 3.1255115938869255e-05 sigma_epsilon: 1.9201749173751685
ESS = 613.40
Time spent on iteration: 19.9s (Total time: 746.6s)
Iteration 5 out of 101:
Scaling_factor: 1 Logprior: -1.8256184576602341 Loglik: -393.862312977174 L_W_old: -13.641487846975453 L_W_new: -17.580110976747193 exp(L_W_new-L_W_old): 0.0194750108564116 weight: 4.1105663675762425e-05 sigma_epsilon: 1.9201749173751685
ESS = 461.89
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 683.7s (Total time: 1430.4s)
Iteration 6 out of 101:
Scaling_factor: 1 Logprior: -1.4905905067394754 Loglik: -386.41684980569204 L_W_old: -16.947264498967158 L_W_new: -20.81143299702408 exp(L_W_new-L_W_old): 0.020980360396634607 weight: 2.0980360396634606e-05 sigma_epsilon: 1.5146536132205992
ESS = 946.12
Time spent on iteration: 18.4s (Total time: 1448.8s)
Iteration 7 out of 101:
Scaling_factor: 1 Logprior: -1.4905905067394754 Loglik: -386.41684980569204 L_W_old: -20.81143299702408 L_W_new: -24.675601495080997 exp(L_W_new-L_W_old): 0.020980360396634756 weight: 2.5139448814811932e-05 sigma_epsilon: 1.5146536132205992
ESS = 840.60
Time spent on iteration: 17.7s (Total time: 1466.4s)
Iteration 8 out of 101:
Scaling_factor: 1 Logprior: -1.4905905067394754 Loglik: -386.41684980569204 L_W_old: -24.675601495080997 L_W_new: -28.53976999313792 exp(L_W_new-L_W_old): 0.020980360396634607 weight: 2.8500036916200123e-05 sigma_epsilon: 1.5146536132205992
ESS = 723.19
Time spent on iteration: 17.8s (Total time: 1484.2s)
Iteration 9 out of 101:
Scaling_factor: 1 Logprior: -1.4905905067394754 Loglik: -386.41684980569204 L_W_old: -28.53976999313792 L_W_new: -32.403938491194836 exp(L_W_new-L_W_old): 0.020980360396634756 weight: 3.0977854001682093e-05 sigma_epsilon: 1.5146536132205992
ESS = 609.56
Time spent on iteration: 18.4s (Total time: 1502.6s)
Iteration 10 out of 101:
Scaling_factor: 1 Logprior: -1.4905905067394754 Loglik: -386.41684980569204 L_W_old: -32.403938491194836 L_W_new: -36.268106989251756 exp(L_W_new-L_W_old): 0.020980360396634683 weight: 3.254368932932133e-05 sigma_epsilon: 1.5146536132205992
ESS = 506.61
Time spent on iteration: 17.7s (Total time: 1520.3s)
Iteration 11 out of 101:
Scaling_factor: 1 Logprior: -1.4905905067394754 Loglik: -386.41684980569204 L_W_old: -36.268106989251756 L_W_new: -40.13227548730868 exp(L_W_new-L_W_old): 0.020980360396634534 weight: 3.3220847638324165e-05 sigma_epsilon: 1.5146536132205992
ESS = 416.97
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 625.9s (Total time: 2146.2s)
Iteration 12 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -39.512803454538094 L_W_new: -43.303570703381546 exp(L_W_new-L_W_old): 0.02257827205071929 weight: 2.257827205071929e-05 sigma_epsilon: 1.647065654533803
ESS = 980.65
Time spent on iteration: 18.2s (Total time: 2164.4s)
Iteration 13 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -43.303570703381546 L_W_new: -47.094337952225004 exp(L_W_new-L_W_old): 0.02257827205071913 weight: 2.342369340668733e-05 sigma_epsilon: 1.647065654533803
ESS = 930.88
Time spent on iteration: 17.5s (Total time: 2181.9s)
Iteration 14 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -47.094337952225004 L_W_new: -50.885105201068455 exp(L_W_new-L_W_old): 0.02257827205071929 weight: 2.383044775564335e-05 sigma_epsilon: 1.647065654533803
ESS = 861.76
Time spent on iteration: 17.5s (Total time: 2199.5s)
Iteration 15 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -50.885105201068455 L_W_new: -54.675872449911914 exp(L_W_new-L_W_old): 0.02257827205071913 weight: 2.381547532693784e-05 sigma_epsilon: 1.647065654533803
ESS = 781.95
Time spent on iteration: 17.6s (Total time: 2217.0s)
Iteration 16 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -54.675872449911914 L_W_new: -58.466639698755365 exp(L_W_new-L_W_old): 0.02257827205071929 weight: 2.3413585458928158e-05 sigma_epsilon: 1.647065654533803
ESS = 697.87
Time spent on iteration: 17.5s (Total time: 2234.6s)
Iteration 17 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -58.466639698755365 L_W_new: -62.257406947598824 exp(L_W_new-L_W_old): 0.02257827205071913 weight: 2.267242760150032e-05 sigma_epsilon: 1.647065654533803
ESS = 614.09
Time spent on iteration: 17.5s (Total time: 2252.0s)
Iteration 18 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -62.257406947598824 L_W_new: -66.04817419644229 exp(L_W_new-L_W_old): 0.02257827205071897 weight: 2.164769577848749e-05 sigma_epsilon: 1.647065654533803
ESS = 533.81
Time spent on iteration: 17.6s (Total time: 2269.6s)
Iteration 19 out of 101:
Scaling_factor: 1 Logprior: -1.6051309661035542 Loglik: -379.0767248843454 L_W_old: -66.04817419644229 L_W_new: -69.83894144528573 exp(L_W_new-L_W_old): 0.022578272050719612 weight: 2.039885032565941e-05 sigma_epsilon: 1.647065654533803
ESS = 459.16
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 618.4s (Total time: 2888.0s)
Iteration 20 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -69.90064521960846 L_W_new: -73.67504734854487 exp(L_W_new-L_W_old): 0.022950808164953308 weight: 2.295080816495331e-05 sigma_epsilon: 2.1018496357648946
ESS = 988.66
Time spent on iteration: 17.4s (Total time: 2905.5s)
Iteration 21 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -73.67504734854487 L_W_new: -77.44944947748127 exp(L_W_new-L_W_old): 0.022950808164953308 weight: 2.1474863812205763e-05 sigma_epsilon: 2.1018496357648946
ESS = 957.61
Time spent on iteration: 17.4s (Total time: 2922.9s)
Iteration 22 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -77.44944947748127 L_W_new: -81.22385160641765 exp(L_W_new-L_W_old): 0.022950808164953634 weight: 1.9865917292834e-05 sigma_epsilon: 2.1018496357648946
ESS = 911.58
Time spent on iteration: 17.3s (Total time: 2940.2s)
Iteration 23 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -81.22385160641765 L_W_new: -84.99825373535406 exp(L_W_new-L_W_old): 0.022950808164953308 weight: 1.8179736976060876e-05 sigma_epsilon: 2.1018496357648946
ESS = 855.24
Time spent on iteration: 17.3s (Total time: 2957.5s)
Iteration 24 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -84.99825373535406 L_W_new: -88.77265586429044 exp(L_W_new-L_W_old): 0.022950808164953634 weight: 1.6466746084005443e-05 sigma_epsilon: 2.1018496357648946
ESS = 792.84
Time spent on iteration: 17.5s (Total time: 2975.0s)
Iteration 25 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -88.77265586429044 L_W_new: -92.54705799322683 exp(L_W_new-L_W_old): 0.022950808164953634 weight: 1.477056122044325e-05 sigma_epsilon: 2.1018496357648946
ESS = 728.00
Time spent on iteration: 17.9s (Total time: 2992.9s)
Iteration 26 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -92.54705799322683 L_W_new: -96.32146012216323 exp(L_W_new-L_W_old): 0.022950808164953308 weight: 1.3127203524630642e-05 sigma_epsilon: 2.1018496357648946
ESS = 663.59
Time spent on iteration: 17.4s (Total time: 3010.3s)
Iteration 27 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -96.32146012216323 L_W_new: -100.09586225109963 exp(L_W_new-L_W_old): 0.022950808164953308 weight: 1.1564885478951308e-05 sigma_epsilon: 2.1018496357648946
ESS = 601.69
Time spent on iteration: 17.4s (Total time: 3027.7s)
Iteration 28 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -100.09586225109963 L_W_new: -103.87026438003602 exp(L_W_new-L_W_old): 0.022950808164953634 weight: 1.010425988899975e-05 sigma_epsilon: 2.1018496357648946
ESS = 543.67
Time spent on iteration: 17.3s (Total time: 3045.0s)
Iteration 29 out of 101:
Scaling_factor: 1 Logprior: -1.9614068987533837 Loglik: -377.4402128936394 L_W_old: -103.87026438003602 L_W_new: -107.64466650897242 exp(L_W_new-L_W_old): 0.022950808164953308 weight: 8.759013641809174e-06 sigma_epsilon: 2.1018496357648946
ESS = 490.31
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 619.4s (Total time: 3664.4s)
Iteration 30 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -102.10572457668229 L_W_new: -105.69496251171577 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.7619370159804112e-05 sigma_epsilon: 1.6493504764941247
ESS = 993.38
Time spent on iteration: 17.5s (Total time: 3681.8s)
Iteration 31 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -105.69496251171577 L_W_new: -109.28420044674927 exp(L_W_new-L_W_old): 0.02761937015980372 weight: 2.8228724370471915e-05 sigma_epsilon: 1.6493504764941247
ESS = 975.40
Time spent on iteration: 17.5s (Total time: 3699.3s)
Iteration 32 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -109.28420044674927 L_W_new: -112.87343838178276 exp(L_W_new-L_W_old): 0.02761937015980372 weight: 2.866059372711104e-05 sigma_epsilon: 1.6493504764941247
ESS = 948.72
Time spent on iteration: 17.5s (Total time: 3716.8s)
Iteration 33 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -112.87343838178276 L_W_new: -116.46267631681624 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.8918659630729368e-05 sigma_epsilon: 1.6493504764941247
ESS = 915.71
Time spent on iteration: 17.4s (Total time: 3734.2s)
Iteration 34 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -116.46267631681624 L_W_new: -120.05191425184974 exp(L_W_new-L_W_old): 0.02761937015980372 weight: 2.9009454324617867e-05 sigma_epsilon: 1.6493504764941247
ESS = 878.32
Time spent on iteration: 17.7s (Total time: 3751.9s)
Iteration 35 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -120.05191425184974 L_W_new: -123.64115218688323 exp(L_W_new-L_W_old): 0.02761937015980372 weight: 2.8941833507052094e-05 sigma_epsilon: 1.6493504764941247
ESS = 838.14
Time spent on iteration: 17.5s (Total time: 3769.3s)
Iteration 36 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -123.64115218688323 L_W_new: -127.23039012191673 exp(L_W_new-L_W_old): 0.02761937015980372 weight: 2.8726456684083053e-05 sigma_epsilon: 1.6493504764941247
ESS = 796.34
Time spent on iteration: 17.5s (Total time: 3786.8s)
Iteration 37 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -127.23039012191673 L_W_new: -130.81962805695022 exp(L_W_new-L_W_old): 0.02761937015980372 weight: 2.837529607572481e-05 sigma_epsilon: 1.6493504764941247
ESS = 753.83
Time spent on iteration: 17.6s (Total time: 3804.4s)
Iteration 38 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -130.81962805695022 L_W_new: -134.4088659919837 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.7901188947620556e-05 sigma_epsilon: 1.6493504764941247
ESS = 711.23
Time spent on iteration: 17.6s (Total time: 3822.0s)
Iteration 39 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -134.4088659919837 L_W_new: -137.99810392701718 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.7317442660132785e-05 sigma_epsilon: 1.6493504764941247
ESS = 668.97
Time spent on iteration: 17.6s (Total time: 3839.5s)
Iteration 40 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -137.99810392701718 L_W_new: -141.5873418620507 exp(L_W_new-L_W_old): 0.027619370159803328 weight: 2.6637496876199286e-05 sigma_epsilon: 1.6493504764941247
ESS = 627.35
Time spent on iteration: 17.4s (Total time: 3857.0s)
Iteration 41 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -141.5873418620507 L_W_new: -145.17657979708417 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.5874643452921753e-05 sigma_epsilon: 1.6493504764941247
ESS = 586.58
Time spent on iteration: 17.5s (Total time: 3874.5s)
Iteration 42 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -145.17657979708417 L_W_new: -148.76581773211768 exp(L_W_new-L_W_old): 0.027619370159803328 weight: 2.504180161626602e-05 sigma_epsilon: 1.6493504764941247
ESS = 546.79
Time spent on iteration: 17.8s (Total time: 3892.2s)
Iteration 43 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -148.76581773211768 L_W_new: -152.35505566715116 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.4151344027973867e-05 sigma_epsilon: 1.6493504764941247
ESS = 508.07
Time spent on iteration: 17.5s (Total time: 3909.7s)
Iteration 44 out of 101:
Scaling_factor: 1 Logprior: -1.6070623957445263 Loglik: -358.92379350334915 L_W_old: -152.35505566715116 L_W_new: -155.94429360218464 exp(L_W_new-L_W_old): 0.02761937015980411 weight: 2.3214968172299732e-05 sigma_epsilon: 1.6493504764941247
ESS = 470.51
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 614.4s (Total time: 4524.1s)
Iteration 45 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -155.14033063435687 L_W_new: -158.71111811801435 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.8133690133525177e-05 sigma_epsilon: 1.636840551180021
ESS = 997.06
Time spent on iteration: 17.4s (Total time: 4541.5s)
Iteration 46 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -158.71111811801435 L_W_new: -162.28190560167184 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.7278870366772383e-05 sigma_epsilon: 1.636840551180021
ESS = 988.65
Time spent on iteration: 17.4s (Total time: 4559.0s)
Iteration 47 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -162.28190560167184 L_W_new: -165.85269308532932 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.637215115154406e-05 sigma_epsilon: 1.636840551180021
ESS = 975.38
Time spent on iteration: 17.4s (Total time: 4576.3s)
Iteration 48 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -165.85269308532932 L_W_new: -169.4234805689868 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.5423018167594796e-05 sigma_epsilon: 1.636840551180021
ESS = 957.75
Time spent on iteration: 17.4s (Total time: 4593.7s)
Iteration 49 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -169.4234805689868 L_W_new: -172.99426805264426 exp(L_W_new-L_W_old): 0.028133690133525978 weight: 2.4440439757857567e-05 sigma_epsilon: 1.636840551180021
ESS = 936.21
Time spent on iteration: 17.8s (Total time: 4611.5s)
Iteration 50 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -172.99426805264426 L_W_new: -176.56505553630174 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.343282599525465e-05 sigma_epsilon: 1.636840551180021
ESS = 911.12
Time spent on iteration: 17.5s (Total time: 4629.0s)
Iteration 51 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -176.56505553630174 L_W_new: -180.13584301995922 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.2408003507387638e-05 sigma_epsilon: 1.636840551180021
ESS = 882.85
Time spent on iteration: 17.6s (Total time: 4646.6s)
Iteration 52 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -180.13584301995922 L_W_new: -183.7066305036167 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.1373203283335505e-05 sigma_epsilon: 1.636840551180021
ESS = 851.70
Time spent on iteration: 17.5s (Total time: 4664.1s)
Iteration 53 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -183.7066305036167 L_W_new: -187.2774179872742 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 2.0335058986896345e-05 sigma_epsilon: 1.636840551180021
ESS = 818.00
Time spent on iteration: 17.3s (Total time: 4681.4s)
Iteration 54 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -187.2774179872742 L_W_new: -190.84820547093167 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.9299613602754388e-05 sigma_epsilon: 1.636840551180021
ESS = 782.06
Time spent on iteration: 17.5s (Total time: 4698.9s)
Iteration 55 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -190.84820547093167 L_W_new: -194.41899295458916 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.8272332534961085e-05 sigma_epsilon: 1.636840551180021
ESS = 744.23
Time spent on iteration: 18.3s (Total time: 4717.2s)
Iteration 56 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -194.41899295458916 L_W_new: -197.98978043824664 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.725812155369782e-05 sigma_epsilon: 1.636840551180021
ESS = 704.87
Time spent on iteration: 17.7s (Total time: 4734.9s)
Iteration 57 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -197.98978043824664 L_W_new: -201.56056792190412 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.626134824256078e-05 sigma_epsilon: 1.636840551180021
ESS = 664.37
Time spent on iteration: 17.3s (Total time: 4752.3s)
Iteration 58 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -201.56056792190412 L_W_new: -205.1313554055616 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.5285865832590158e-05 sigma_epsilon: 1.636840551180021
ESS = 623.15
Time spent on iteration: 17.2s (Total time: 4769.5s)
Iteration 59 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -205.1313554055616 L_W_new: -208.70214288921903 exp(L_W_new-L_W_old): 0.028133690133526776 weight: 1.4335038520310433e-05 sigma_epsilon: 1.636840551180021
ESS = 581.66
Time spent on iteration: 18.3s (Total time: 4787.8s)
Iteration 60 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -208.70214288921903 L_W_new: -212.27293037287652 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.3411767555312732e-05 sigma_epsilon: 1.636840551180021
ESS = 540.33
Time spent on iteration: 18.9s (Total time: 4806.7s)
Iteration 61 out of 101:
Scaling_factor: 1 Logprior: -1.596468837085316 Loglik: -357.0787483657478 L_W_old: -212.27293037287652 L_W_new: -215.843717856534 exp(L_W_new-L_W_old): 0.028133690133525176 weight: 1.2518517549046042e-05 sigma_epsilon: 1.636840551180021
ESS = 499.59
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 682.2s (Total time: 5488.9s)
Iteration 62 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -205.1560250453132 L_W_new: -208.54839671884378 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 3.362882565079515e-05 sigma_epsilon: 1.6572454514580952
ESS = 997.41
Time spent on iteration: 19.2s (Total time: 5508.1s)
Iteration 63 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -208.54839671884378 L_W_new: -211.94076839237434 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 3.721176136490596e-05 sigma_epsilon: 1.6572454514580952
ESS = 989.60
Time spent on iteration: 18.8s (Total time: 5526.9s)
Iteration 64 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -211.94076839237434 L_W_new: -215.33314006590487 exp(L_W_new-L_W_old): 0.03362882565079611 weight: 4.106983384526982e-05 sigma_epsilon: 1.6572454514580952
ESS = 976.57
Time spent on iteration: 19.4s (Total time: 5546.3s)
Iteration 65 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -215.33314006590487 L_W_new: -218.72551173943543 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 4.5209662025535554e-05 sigma_epsilon: 1.6572454514580952
ESS = 958.38
Time spent on iteration: 18.6s (Total time: 5564.8s)
Iteration 66 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -218.72551173943543 L_W_new: -222.117883412966 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 4.9635889575764236e-05 sigma_epsilon: 1.6572454514580952
ESS = 935.20
Time spent on iteration: 18.7s (Total time: 5583.6s)
Iteration 67 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -222.117883412966 L_W_new: -225.51025508649656 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 5.4350897248461035e-05 sigma_epsilon: 1.6572454514580952
ESS = 907.33
Time spent on iteration: 18.7s (Total time: 5602.3s)
Iteration 68 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -225.51025508649656 L_W_new: -228.90262676002712 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 5.9354527389913995e-05 sigma_epsilon: 1.6572454514580952
ESS = 875.17
Time spent on iteration: 18.8s (Total time: 5621.1s)
Iteration 69 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -228.90262676002712 L_W_new: -232.29499843355768 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 6.464382980163394e-05 sigma_epsilon: 1.6572454514580952
ESS = 839.25
Time spent on iteration: 19.5s (Total time: 5640.6s)
Iteration 70 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -232.29499843355768 L_W_new: -235.68737010708824 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 7.021283855495094e-05 sigma_epsilon: 1.6572454514580952
ESS = 800.17
Time spent on iteration: 18.9s (Total time: 5659.5s)
Iteration 71 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -235.68737010708824 L_W_new: -239.0797417806188 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 7.605238938151589e-05 sigma_epsilon: 1.6572454514580952
ESS = 758.63
Time spent on iteration: 19.1s (Total time: 5678.6s)
Iteration 72 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -239.0797417806188 L_W_new: -242.4721134541493 exp(L_W_new-L_W_old): 0.03362882565079706 weight: 8.214998682420516e-05 sigma_epsilon: 1.6572454514580952
ESS = 715.36
Time spent on iteration: 19.8s (Total time: 5698.4s)
Iteration 73 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -242.4721134541493 L_W_new: -245.86448512767987 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 8.848972940192014e-05 sigma_epsilon: 1.6572454514580952
ESS = 671.09
Time spent on iteration: 19.5s (Total time: 5717.9s)
Iteration 74 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -245.86448512767987 L_W_new: -249.25685680121043 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 9.505229961517051e-05 sigma_epsilon: 1.6572454514580952
ESS = 626.51
Time spent on iteration: 19.8s (Total time: 5737.7s)
Iteration 75 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -249.25685680121043 L_W_new: -252.649228474741 exp(L_W_new-L_W_old): 0.033628825650795155 weight: 0.00010181502373005073 sigma_epsilon: 1.6572454514580952
ESS = 582.28
Time spent on iteration: 19.2s (Total time: 5756.9s)
Iteration 76 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -252.649228474741 L_W_new: -256.0416001482715 exp(L_W_new-L_W_old): 0.03362882565079611 weight: 0.00010875200399875454 sigma_epsilon: 1.6572454514580952
ESS = 538.97
Time spent on iteration: 18.4s (Total time: 5775.3s)
Iteration 77 out of 101:
Scaling_factor: 1 Logprior: -1.6137246334798472 Loglik: -339.2371673530556 L_W_old: -256.0416001482715 L_W_new: -259.43397182180206 exp(L_W_new-L_W_old): 0.03362882565079611 weight: 0.00011583432341169805 sigma_epsilon: 1.6572454514580952
ESS = 497.04
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 670.1s (Total time: 6445.4s)
Iteration 78 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -266.3057450147103 L_W_new: -269.78929934320587 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 3.0698105742369704e-05 sigma_epsilon: 1.5890923424018237
ESS = 997.05
Time spent on iteration: 19.4s (Total time: 6464.8s)
Iteration 79 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -269.78929934320587 L_W_new: -273.27285367170145 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 2.9363401302443438e-05 sigma_epsilon: 1.5890923424018237
ESS = 988.34
Time spent on iteration: 18.8s (Total time: 6483.7s)
Iteration 80 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -273.27285367170145 L_W_new: -276.7564080001971 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 2.800401179803446e-05 sigma_epsilon: 1.5890923424018237
ESS = 974.17
Time spent on iteration: 18.9s (Total time: 6502.6s)
Iteration 81 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -276.7564080001971 L_W_new: -280.2399623286927 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 2.6629304353527012e-05 sigma_epsilon: 1.5890923424018237
ESS = 955.03
Time spent on iteration: 19.7s (Total time: 6522.3s)
Iteration 82 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -280.2399623286927 L_W_new: -283.7235166571883 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 2.5248440620420368e-05 sigma_epsilon: 1.5890923424018237
ESS = 931.52
Time spent on iteration: 20.0s (Total time: 6542.3s)
Iteration 83 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -283.7235166571883 L_W_new: -287.2070709856839 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 2.3870241531945543e-05 sigma_epsilon: 1.5890923424018237
ESS = 904.36
Time spent on iteration: 20.1s (Total time: 6562.4s)
Iteration 84 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -287.2070709856839 L_W_new: -290.6906253141795 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 2.250306447254504e-05 sigma_epsilon: 1.5890923424018237
ESS = 874.27
Time spent on iteration: 19.7s (Total time: 6582.1s)
Iteration 85 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -290.6906253141795 L_W_new: -294.1741796426751 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 2.115469614484432e-05 sigma_epsilon: 1.5890923424018237
ESS = 841.99
Time spent on iteration: 19.3s (Total time: 6601.4s)
Iteration 86 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -294.1741796426751 L_W_new: -297.6577339711707 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 1.9832263641633087e-05 sigma_epsilon: 1.5890923424018237
ESS = 808.22
Time spent on iteration: 19.3s (Total time: 6620.7s)
Iteration 87 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -297.6577339711707 L_W_new: -301.1412882996663 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 1.854216536716524e-05 sigma_epsilon: 1.5890923424018237
ESS = 773.60
Time spent on iteration: 19.6s (Total time: 6640.3s)
Iteration 88 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -301.1412882996663 L_W_new: -304.6248426281619 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 1.729002256087666e-05 sigma_epsilon: 1.5890923424018237
ESS = 738.68
Time spent on iteration: 19.3s (Total time: 6659.6s)
Iteration 89 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -304.6248426281619 L_W_new: -308.10839695665754 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 1.608065131550912e-05 sigma_epsilon: 1.5890923424018237
ESS = 703.94
Time spent on iteration: 19.3s (Total time: 6678.9s)
Iteration 90 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -308.10839695665754 L_W_new: -311.59195128515313 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 1.4918054200776757e-05 sigma_epsilon: 1.5890923424018237
ESS = 669.77
Time spent on iteration: 17.9s (Total time: 6696.9s)
Iteration 91 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -311.59195128515313 L_W_new: -315.0755056136488 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 1.3805429942580386e-05 sigma_epsilon: 1.5890923424018237
ESS = 636.46
Time spent on iteration: 19.0s (Total time: 6715.8s)
Iteration 92 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -315.0755056136488 L_W_new: -318.55905994214436 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 1.2745199092275642e-05 sigma_epsilon: 1.5890923424018237
ESS = 604.25
Time spent on iteration: 19.4s (Total time: 6735.2s)
Iteration 93 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -318.55905994214436 L_W_new: -322.04261427063994 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 1.1739043262798523e-05 sigma_epsilon: 1.5890923424018237
ESS = 573.30
Time spent on iteration: 19.2s (Total time: 6754.4s)
Iteration 94 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -322.04261427063994 L_W_new: -325.5261685991356 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 1.0787955308175607e-05 sigma_epsilon: 1.5890923424018237
ESS = 543.72
Time spent on iteration: 19.4s (Total time: 6773.8s)
Iteration 95 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -325.5261685991356 L_W_new: -329.0097229276312 exp(L_W_new-L_W_old): 0.030698105742369704 weight: 9.892297768636428e-06 sigma_epsilon: 1.5890923424018237
ESS = 515.57
Time spent on iteration: 18.0s (Total time: 6791.8s)
Iteration 96 out of 101:
Scaling_factor: 1 Logprior: -1.5556160490442292 Loglik: -348.3554328495606 L_W_old: -329.0097229276312 L_W_new: -332.4932772561268 exp(L_W_new-L_W_old): 0.03069810574236796 weight: 9.051866976025581e-06 sigma_epsilon: 1.5890923424018237
ESS = 488.87
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 667.0s (Total time: 7458.8s)
Iteration 97 out of 101:
Scaling_factor: 1 Logprior: -1.4374577866683913 Loglik: -339.0958988150452 L_W_old: -323.5785616609613 L_W_new: -326.96952064911176 exp(L_W_new-L_W_old): 0.03367636617313716 weight: 3.3676366173137155e-05 sigma_epsilon: 1.4551781922599256
ESS = 998.29
Time spent on iteration: 18.6s (Total time: 7477.4s)
Iteration 98 out of 101:
Scaling_factor: 1 Logprior: -1.4374577866683913 Loglik: -339.0958988150452 L_W_old: -326.96952064911176 L_W_new: -330.36047963726224 exp(L_W_new-L_W_old): 0.03367636617313524 weight: 3.353066718661356e-05 sigma_epsilon: 1.4551781922599256
ESS = 993.43
Time spent on iteration: 19.0s (Total time: 7496.4s)
Iteration 99 out of 101:
Scaling_factor: 1 Logprior: -1.4374577866683913 Loglik: -339.0958988150452 L_W_old: -330.36047963726224 L_W_new: -333.7514386254127 exp(L_W_new-L_W_old): 0.03367636617313716 weight: 3.332867166339593e-05 sigma_epsilon: 1.4551781922599256
ESS = 985.80
Time spent on iteration: 19.0s (Total time: 7515.4s)
Iteration 100 out of 101:
Scaling_factor: 1 Logprior: -1.4374577866683913 Loglik: -339.0958988150452 L_W_old: -333.7514386254127 L_W_new: -337.14239761356316 exp(L_W_new-L_W_old): 0.03367636617313524 weight: 3.307338127668933e-05 sigma_epsilon: 1.4551781922599256
ESS = 975.78
Time spent on iteration: 19.2s (Total time: 7534.7s)
Iteration 101 out of 101:
Scaling_factor: 1 Logprior: -1.4374577866683913 Loglik: -339.0958988150452 L_W_old: -337.14239761356316 L_W_new: -340.5333566017136 exp(L_W_new-L_W_old): 0.03367636617313716 weight: 3.276796228054093e-05 sigma_epsilon: 1.4551781922599256
ESS = 963.72
Final Resampling
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 669.8s (Total time: 8204.5s)
particles_SMC_cpi_garma_02000_tapered, diagnostics_SMC_cpi_garma_02000_tapered = smc_sampler_pro(particles_init, lb_param, ub_param,
data, model_spec,
sigma_prior, sigma_shape, sigma_scale,
delta = proposal_variance, N_bridges = N_iterations, N_updates = N_MCMC_updates,
spacing = spacing_type, resampling = True, MCMC = True, alpha=threshold,
loglik_scaling = False, verbose = True, print_diagnostic = True)
Iteration 1 out of 101:
ESS = 662.53
Time spent on iteration: 0.0s (Total time: 0.0s)
Iteration 2 out of 101:
Scaling_factor: 1 Logprior: -1.0260968635681478 Loglik: -1598.1775725260945 L_W_old: -1.0260968635681478 L_W_new: -17.007872588829095 exp(L_W_new-L_W_old): 1.1460484853115659e-07 weight: 3.9231847510194116e-11 sigma_epsilon: 2.793205316113943
ESS = 140.58
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 809.1s (Total time: 809.1s)
Iteration 3 out of 101:
Scaling_factor: 1 Logprior: -1.2051039735304603 Loglik: -405.71627247496906 L_W_old: -5.2622666982801505 L_W_new: -9.319429423029842 exp(L_W_new-L_W_old): 0.01729802882451389 weight: 1.729802882451389e-05 sigma_epsilon: 3.1111294555386375
ESS = 777.02
Time spent on iteration: 30.1s (Total time: 839.3s)
Iteration 4 out of 101:
Scaling_factor: 1 Logprior: -1.2051039735304603 Loglik: -405.71627247496906 L_W_old: -9.319429423029842 L_W_new: -13.376592147779533 exp(L_W_new-L_W_old): 0.01729802882451389 weight: 2.3367582925255783e-05 sigma_epsilon: 3.1111294555386375
ESS = 570.74
Time spent on iteration: 29.2s (Total time: 868.5s)
Iteration 5 out of 101:
Scaling_factor: 1 Logprior: -1.2051039735304603 Loglik: -405.71627247496906 L_W_old: -13.376592147779533 L_W_new: -17.43375487252922 exp(L_W_new-L_W_old): 0.017298028824513954 weight: 2.4528010950943477e-05 sigma_epsilon: 3.1111294555386375
ESS = 440.87
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 753.6s (Total time: 1622.0s)
Iteration 6 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -17.288923916076115 L_W_new: -21.5002985501641 exp(L_W_new-L_W_old): 0.014825974034650323 weight: 1.4825974034650323e-05 sigma_epsilon: 1.9255035993368312
ESS = 953.58
Time spent on iteration: 30.2s (Total time: 1652.2s)
Iteration 7 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -21.5002985501641 L_W_new: -25.71167318425208 exp(L_W_new-L_W_old): 0.014825974034650377 weight: 1.1260442994592207e-05 sigma_epsilon: 1.9255035993368312
ESS = 871.03
Time spent on iteration: 29.1s (Total time: 1681.4s)
Iteration 8 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -25.71167318425208 L_W_new: -29.92304781834007 exp(L_W_new-L_W_old): 0.014825974034650271 weight: 8.155383244183342e-06 sigma_epsilon: 1.9255035993368312
ESS = 786.76
Time spent on iteration: 29.3s (Total time: 1710.7s)
Iteration 9 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -29.92304781834007 L_W_new: -34.134422452428055 exp(L_W_new-L_W_old): 0.014825974034650323 weight: 5.7146350011260534e-06 sigma_epsilon: 1.9255035993368312
ESS = 710.28
Time spent on iteration: 29.6s (Total time: 1740.3s)
Iteration 10 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -34.134422452428055 L_W_new: -38.345797086516036 exp(L_W_new-L_W_old): 0.014825974034650377 weight: 3.907475996427312e-06 sigma_epsilon: 1.9255035993368312
ESS = 643.37
Time spent on iteration: 29.9s (Total time: 1770.2s)
Iteration 11 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -38.345797086516036 L_W_new: -42.557171720604025 exp(L_W_new-L_W_old): 0.014825974034650271 weight: 2.621815704864555e-06 sigma_epsilon: 1.9255035993368312
ESS = 585.38
Time spent on iteration: 29.1s (Total time: 1799.2s)
Iteration 12 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -42.557171720604025 L_W_new: -46.768546354692006 exp(L_W_new-L_W_old): 0.014825974034650377 weight: 1.7329880530925976e-06 sigma_epsilon: 1.9255035993368312
ESS = 535.11
Time spent on iteration: 29.2s (Total time: 1828.4s)
Iteration 13 out of 101:
Scaling_factor: 1 Logprior: -0.4434253797241755 Loglik: -421.13746340879845 L_W_old: -46.768546354692006 L_W_new: -50.97992098877999 exp(L_W_new-L_W_old): 0.014825974034650377 weight: 1.1316034065132498e-06 sigma_epsilon: 1.9255035993368312
ESS = 491.35
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 748.9s (Total time: 2577.3s)
Iteration 14 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -44.38015285240671 L_W_new: -48.05032608299196 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 2.5472057025119608e-05 sigma_epsilon: 1.7915875644958519
ESS = 993.03
Time spent on iteration: 29.1s (Total time: 2606.4s)
Iteration 15 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -48.05032608299196 L_W_new: -51.7204993135772 exp(L_W_new-L_W_old): 0.025472057025119788 weight: 2.8096977330726406e-05 sigma_epsilon: 1.7915875644958519
ESS = 975.33
Time spent on iteration: 29.1s (Total time: 2635.6s)
Iteration 16 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -51.7204993135772 L_W_new: -55.390672544162435 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 3.0776444623261255e-05 sigma_epsilon: 1.7915875644958519
ESS = 950.78
Time spent on iteration: 29.5s (Total time: 2665.1s)
Iteration 17 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -55.390672544162435 L_W_new: -59.060845774747676 exp(L_W_new-L_W_old): 0.025472057025119788 weight: 3.3502463052961784e-05 sigma_epsilon: 1.7915875644958519
ESS = 922.16
Time spent on iteration: 29.6s (Total time: 2694.7s)
Iteration 18 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -59.060845774747676 L_W_new: -62.73101900533292 exp(L_W_new-L_W_old): 0.025472057025119788 weight: 3.626817650990686e-05 sigma_epsilon: 1.7915875644958519
ESS = 891.37
Time spent on iteration: 29.1s (Total time: 2723.9s)
Iteration 19 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -62.73101900533292 L_W_new: -66.40119223591816 exp(L_W_new-L_W_old): 0.025472057025119788 weight: 3.9067671042137666e-05 sigma_epsilon: 1.7915875644958519
ESS = 859.71
Time spent on iteration: 29.6s (Total time: 2753.5s)
Iteration 20 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -66.40119223591816 L_W_new: -70.07136546650341 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 4.1895800441893185e-05 sigma_epsilon: 1.7915875644958519
ESS = 828.02
Time spent on iteration: 29.2s (Total time: 2782.7s)
Iteration 21 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -70.07136546650341 L_W_new: -73.74153869708864 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 4.4748037987659695e-05 sigma_epsilon: 1.7915875644958519
ESS = 796.83
Time spent on iteration: 29.0s (Total time: 2811.7s)
Iteration 22 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -73.74153869708864 L_W_new: -77.41171192767388 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 4.7620353729433665e-05 sigma_epsilon: 1.7915875644958519
ESS = 766.48
Time spent on iteration: 29.2s (Total time: 2840.8s)
Iteration 23 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -77.41171192767388 L_W_new: -81.08188515825913 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 5.050911493335557e-05 sigma_epsilon: 1.7915875644958519
ESS = 737.16
Time spent on iteration: 29.2s (Total time: 2870.0s)
Iteration 24 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -81.08188515825913 L_W_new: -84.75205838884436 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 5.3411006608023354e-05 sigma_epsilon: 1.7915875644958519
ESS = 708.99
Time spent on iteration: 29.0s (Total time: 2899.0s)
Iteration 25 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -84.75205838884436 L_W_new: -88.4222316194296 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 5.632296893410207e-05 sigma_epsilon: 1.7915875644958519
ESS = 682.01
Time spent on iteration: 29.1s (Total time: 2928.2s)
Iteration 26 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -88.4222316194296 L_W_new: -92.09240485001484 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 5.9242148618423225e-05 sigma_epsilon: 1.7915875644958519
ESS = 656.22
Time spent on iteration: 29.2s (Total time: 2957.4s)
Iteration 27 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -92.09240485001484 L_W_new: -95.7625780806001 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 6.216586152531464e-05 sigma_epsilon: 1.7915875644958519
ESS = 631.61
Time spent on iteration: 29.0s (Total time: 2986.4s)
Iteration 28 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -95.7625780806001 L_W_new: -99.43275131118533 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 6.509156430940925e-05 sigma_epsilon: 1.7915875644958519
ESS = 608.15
Time spent on iteration: 29.9s (Total time: 3016.3s)
Iteration 29 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -99.43275131118533 L_W_new: -103.10292454177058 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 6.801683313795486e-05 sigma_epsilon: 1.7915875644958519
ESS = 585.80
Time spent on iteration: 29.1s (Total time: 3045.5s)
Iteration 30 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -103.10292454177058 L_W_new: -106.7730977723558 exp(L_W_new-L_W_old): 0.02547205702512033 weight: 7.093934792395555e-05 sigma_epsilon: 1.7915875644958519
ESS = 564.50
Time spent on iteration: 29.1s (Total time: 3074.6s)
Iteration 31 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -106.7730977723558 L_W_new: -110.44327100294105 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 7.385688078525173e-05 sigma_epsilon: 1.7915875644958519
ESS = 544.21
Time spent on iteration: 29.2s (Total time: 3103.8s)
Iteration 32 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -110.44327100294105 L_W_new: -114.11344423352628 exp(L_W_new-L_W_old): 0.025472057025119968 weight: 7.676728769719696e-05 sigma_epsilon: 1.7915875644958519
ESS = 524.88
Time spent on iteration: 29.3s (Total time: 3133.1s)
Iteration 33 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -114.11344423352628 L_W_new: -117.78361746411153 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 7.966850251940014e-05 sigma_epsilon: 1.7915875644958519
ESS = 506.46
Time spent on iteration: 29.0s (Total time: 3162.2s)
Iteration 34 out of 101:
Scaling_factor: 1 Logprior: -0.3380740853838317 Loglik: -367.017323058524 L_W_old: -117.78361746411153 L_W_new: -121.45379069469678 exp(L_W_new-L_W_old): 0.025472057025119607 weight: 8.255853275411584e-05 sigma_epsilon: 1.7915875644958519
ESS = 488.90
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 754.3s (Total time: 3916.5s)
Iteration 35 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -122.4413538053761 L_W_new: -126.13664148694096 exp(L_W_new-L_W_old): 0.024840306536234945 weight: 2.4840306536234946e-05 sigma_epsilon: 1.9958166703889746
ESS = 998.71
Time spent on iteration: 29.4s (Total time: 3945.8s)
Iteration 36 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -126.13664148694096 L_W_new: -129.83192916850584 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.505217871785168e-05 sigma_epsilon: 1.9958166703889746
ESS = 995.08
Time spent on iteration: 29.4s (Total time: 3975.2s)
Iteration 37 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -129.83192916850584 L_W_new: -133.5272168500707 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.5233155100580254e-05 sigma_epsilon: 1.9958166703889746
ESS = 989.47
Time spent on iteration: 29.5s (Total time: 4004.7s)
Iteration 38 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -133.5272168500707 L_W_new: -137.22250453163554 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.538413507817464e-05 sigma_epsilon: 1.9958166703889746
ESS = 982.19
Time spent on iteration: 29.5s (Total time: 4034.2s)
Iteration 39 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -137.22250453163554 L_W_new: -140.91779221320039 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.55060652781438e-05 sigma_epsilon: 1.9958166703889746
ESS = 973.51
Time spent on iteration: 29.5s (Total time: 4063.7s)
Iteration 40 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -140.91779221320039 L_W_new: -144.61307989476526 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.5599928198837663e-05 sigma_epsilon: 1.9958166703889746
ESS = 963.67
Time spent on iteration: 29.3s (Total time: 4093.0s)
Iteration 41 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -144.61307989476526 L_W_new: -148.3083675763301 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.5666732374329918e-05 sigma_epsilon: 1.9958166703889746
ESS = 952.87
Time spent on iteration: 29.4s (Total time: 4122.4s)
Iteration 42 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -148.3083675763301 L_W_new: -152.003655257895 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.5707503909169965e-05 sigma_epsilon: 1.9958166703889746
ESS = 941.27
Time spent on iteration: 29.4s (Total time: 4151.8s)
Iteration 43 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -152.003655257895 L_W_new: -155.69894293945984 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.5723279228976093e-05 sigma_epsilon: 1.9958166703889746
ESS = 929.04
Time spent on iteration: 31.2s (Total time: 4183.0s)
Iteration 44 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -155.69894293945984 L_W_new: -159.3942306210247 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.571509890091358e-05 sigma_epsilon: 1.9958166703889746
ESS = 916.30
Time spent on iteration: 29.8s (Total time: 4212.8s)
Iteration 45 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -159.3942306210247 L_W_new: -163.08951830258957 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.5684002388916495e-05 sigma_epsilon: 1.9958166703889746
ESS = 903.15
Time spent on iteration: 29.7s (Total time: 4242.5s)
Iteration 46 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -163.08951830258957 L_W_new: -166.78480598415442 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.5631023620661097e-05 sigma_epsilon: 1.9958166703889746
ESS = 889.70
Time spent on iteration: 29.2s (Total time: 4271.8s)
Iteration 47 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -166.78480598415442 L_W_new: -170.4800936657193 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.555718725602292e-05 sigma_epsilon: 1.9958166703889746
ESS = 876.01
Time spent on iteration: 29.4s (Total time: 4301.1s)
Iteration 48 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -170.4800936657193 L_W_new: -174.17538134728414 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.546350555931824e-05 sigma_epsilon: 1.9958166703889746
ESS = 862.17
Time spent on iteration: 30.1s (Total time: 4331.2s)
Iteration 49 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -174.17538134728414 L_W_new: -177.870669028849 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.5350975789598818e-05 sigma_epsilon: 1.9958166703889746
ESS = 848.23
Time spent on iteration: 29.1s (Total time: 4360.3s)
Iteration 50 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -177.870669028849 L_W_new: -181.56595671041387 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.522057803445059e-05 sigma_epsilon: 1.9958166703889746
ESS = 834.24
Time spent on iteration: 30.1s (Total time: 4390.4s)
Iteration 51 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -181.56595671041387 L_W_new: -185.26124439197872 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.5073273422884132e-05 sigma_epsilon: 1.9958166703889746
ESS = 820.25
Time spent on iteration: 29.5s (Total time: 4419.9s)
Iteration 52 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -185.26124439197872 L_W_new: -188.95653207354357 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.4910002661986354e-05 sigma_epsilon: 1.9958166703889746
ESS = 806.29
Time spent on iteration: 29.5s (Total time: 4449.4s)
Iteration 53 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -188.95653207354357 L_W_new: -192.65181975510845 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.4731684850084457e-05 sigma_epsilon: 1.9958166703889746
ESS = 792.39
Time spent on iteration: 29.5s (Total time: 4478.9s)
Iteration 54 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -192.65181975510845 L_W_new: -196.3471074366733 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.4539216526162234e-05 sigma_epsilon: 1.9958166703889746
ESS = 778.58
Time spent on iteration: 29.7s (Total time: 4508.6s)
Iteration 55 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -196.3471074366733 L_W_new: -200.04239511823818 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.4333470921362516e-05 sigma_epsilon: 1.9958166703889746
ESS = 764.88
Time spent on iteration: 29.4s (Total time: 4538.0s)
Iteration 56 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -200.04239511823818 L_W_new: -203.73768279980303 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.4115297383658665e-05 sigma_epsilon: 1.9958166703889746
ESS = 751.32
Time spent on iteration: 29.2s (Total time: 4567.2s)
Iteration 57 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -203.73768279980303 L_W_new: -207.4329704813679 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.3885520951193166e-05 sigma_epsilon: 1.9958166703889746
ESS = 737.91
Time spent on iteration: 29.2s (Total time: 4596.4s)
Iteration 58 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -207.4329704813679 L_W_new: -211.12825816293275 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.364494205360456e-05 sigma_epsilon: 1.9958166703889746
ESS = 724.66
Time spent on iteration: 29.5s (Total time: 4625.9s)
Iteration 59 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -211.12825816293275 L_W_new: -214.8235458444976 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.3394336323807468e-05 sigma_epsilon: 1.9958166703889746
ESS = 711.60
Time spent on iteration: 30.2s (Total time: 4656.1s)
Iteration 60 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -214.8235458444976 L_W_new: -218.51883352606245 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.313445450540577e-05 sigma_epsilon: 1.9958166703889746
ESS = 698.71
Time spent on iteration: 29.2s (Total time: 4685.3s)
Iteration 61 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -218.51883352606245 L_W_new: -222.21412120762733 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.2866022443134524e-05 sigma_epsilon: 1.9958166703889746
ESS = 686.03
Time spent on iteration: 29.2s (Total time: 4714.5s)
Iteration 62 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -222.21412120762733 L_W_new: -225.90940888919218 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.2589741145599245e-05 sigma_epsilon: 1.9958166703889746
ESS = 673.54
Time spent on iteration: 29.2s (Total time: 4743.7s)
Iteration 63 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -225.90940888919218 L_W_new: -229.60469657075706 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.2306286911147987e-05 sigma_epsilon: 1.9958166703889746
ESS = 661.27
Time spent on iteration: 29.3s (Total time: 4773.0s)
Iteration 64 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -229.60469657075706 L_W_new: -233.2999842523219 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.2016311509008063e-05 sigma_epsilon: 1.9958166703889746
ESS = 649.20
Time spent on iteration: 29.4s (Total time: 4802.4s)
Iteration 65 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -233.2999842523219 L_W_new: -236.99527193388676 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.1720442408872746e-05 sigma_epsilon: 1.9958166703889746
ESS = 637.35
Time spent on iteration: 29.0s (Total time: 4831.4s)
Iteration 66 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -236.99527193388676 L_W_new: -240.69055961545163 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.1419283053056453e-05 sigma_epsilon: 1.9958166703889746
ESS = 625.72
Time spent on iteration: 29.1s (Total time: 4860.5s)
Iteration 67 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -240.69055961545163 L_W_new: -244.38584729701648 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.1113413166053287e-05 sigma_epsilon: 1.9958166703889746
ESS = 614.30
Time spent on iteration: 29.3s (Total time: 4889.8s)
Iteration 68 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -244.38584729701648 L_W_new: -248.08113497858136 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.080338909696393e-05 sigma_epsilon: 1.9958166703889746
ESS = 603.10
Time spent on iteration: 29.2s (Total time: 4919.0s)
Iteration 69 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -248.08113497858136 L_W_new: -251.7764226601462 exp(L_W_new-L_W_old): 0.0248403065362353 weight: 2.0489744190794075e-05 sigma_epsilon: 1.9958166703889746
ESS = 592.13
Time spent on iteration: 29.1s (Total time: 4948.1s)
Iteration 70 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -251.7764226601462 L_W_new: -255.4717103417111 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 2.0172989185034572e-05 sigma_epsilon: 1.9958166703889746
ESS = 581.37
Time spent on iteration: 29.3s (Total time: 4977.5s)
Iteration 71 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -255.4717103417111 L_W_new: -259.166998023276 exp(L_W_new-L_W_old): 0.024840306536233887 weight: 1.9853612628340135e-05 sigma_epsilon: 1.9958166703889746
ESS = 570.83
Time spent on iteration: 29.4s (Total time: 5006.8s)
Iteration 72 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -259.166998023276 L_W_new: -262.8622857048408 exp(L_W_new-L_W_old): 0.024840306536236003 weight: 1.953208131840939e-05 sigma_epsilon: 1.9958166703889746
ESS = 560.50
Time spent on iteration: 29.4s (Total time: 5036.2s)
Iteration 73 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -262.8622857048408 L_W_new: -266.5575733864057 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 1.92088407564449e-05 sigma_epsilon: 1.9958166703889746
ESS = 550.39
Time spent on iteration: 30.1s (Total time: 5066.3s)
Iteration 74 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -266.5575733864057 L_W_new: -270.2528610679705 exp(L_W_new-L_W_old): 0.024840306536236003 weight: 1.8884315615840623e-05 sigma_epsilon: 1.9958166703889746
ESS = 540.49
Time spent on iteration: 29.2s (Total time: 5095.5s)
Iteration 75 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -270.2528610679705 L_W_new: -273.9481487495354 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 1.8558910222868995e-05 sigma_epsilon: 1.9958166703889746
ESS = 530.81
Time spent on iteration: 29.4s (Total time: 5124.9s)
Iteration 76 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -273.9481487495354 L_W_new: -277.64343643110027 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 1.8233009047420554e-05 sigma_epsilon: 1.9958166703889746
ESS = 521.32
Time spent on iteration: 29.5s (Total time: 5154.3s)
Iteration 77 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -277.64343643110027 L_W_new: -281.3387241126651 exp(L_W_new-L_W_old): 0.024840306536236003 weight: 1.790697720191235e-05 sigma_epsilon: 1.9958166703889746
ESS = 512.05
Time spent on iteration: 29.1s (Total time: 5183.4s)
Iteration 78 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -281.3387241126651 L_W_new: -285.03401179422997 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 1.7581160946683413e-05 sigma_epsilon: 1.9958166703889746
ESS = 502.97
Time spent on iteration: 30.0s (Total time: 5213.4s)
Iteration 79 out of 101:
Scaling_factor: 1 Logprior: -0.49686031373571204 Loglik: -369.528768156486 L_W_old: -285.03401179422997 L_W_new: -288.72929947579485 exp(L_W_new-L_W_old): 0.02484030653623459 weight: 1.725588820031097e-05 sigma_epsilon: 1.9958166703889746
ESS = 494.10
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 750.8s (Total time: 5964.2s)
Iteration 80 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -286.32047354348697 L_W_new: -289.9885277310506 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.5526090639361802e-05 sigma_epsilon: 1.639283679142557
ESS = 999.74
Time spent on iteration: 29.3s (Total time: 5993.5s)
Iteration 81 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -289.9885277310506 L_W_new: -293.6565819186143 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.573758999586423e-05 sigma_epsilon: 1.639283679142557
ESS = 998.99
Time spent on iteration: 29.2s (Total time: 6022.7s)
Iteration 82 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -293.6565819186143 L_W_new: -297.32463610617793 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.594417432627161e-05 sigma_epsilon: 1.639283679142557
ESS = 997.77
Time spent on iteration: 29.2s (Total time: 6051.9s)
Iteration 83 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -297.32463610617793 L_W_new: -300.9926902937416 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.6145809742396342e-05 sigma_epsilon: 1.639283679142557
ESS = 996.10
Time spent on iteration: 29.3s (Total time: 6081.3s)
Iteration 84 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -300.9926902937416 L_W_new: -304.66074448130524 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.63424666546827e-05 sigma_epsilon: 1.639283679142557
ESS = 994.01
Time spent on iteration: 29.2s (Total time: 6110.5s)
Iteration 85 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -304.66074448130524 L_W_new: -308.32879866886884 exp(L_W_new-L_W_old): 0.02552609063936325 weight: 2.653411965151216e-05 sigma_epsilon: 1.639283679142557
ESS = 991.53
Time spent on iteration: 29.2s (Total time: 6139.7s)
Iteration 86 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -308.32879866886884 L_W_new: -311.9968528564325 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.6720747376954193e-05 sigma_epsilon: 1.639283679142557
ESS = 988.67
Time spent on iteration: 29.2s (Total time: 6168.9s)
Iteration 87 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -311.9968528564325 L_W_new: -315.66490704399615 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.6902332407428972e-05 sigma_epsilon: 1.639283679142557
ESS = 985.47
Time spent on iteration: 29.1s (Total time: 6198.0s)
Iteration 88 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -315.66490704399615 L_W_new: -319.3329612315598 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.7078861127641986e-05 sigma_epsilon: 1.639283679142557
ESS = 981.94
Time spent on iteration: 29.2s (Total time: 6227.2s)
Iteration 89 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -319.3329612315598 L_W_new: -323.00101541912346 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.7250323606213937e-05 sigma_epsilon: 1.639283679142557
ESS = 978.10
Time spent on iteration: 29.4s (Total time: 6256.6s)
Iteration 90 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -323.00101541912346 L_W_new: -326.6690696066871 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.7416713471331955e-05 sigma_epsilon: 1.639283679142557
ESS = 973.98
Time spent on iteration: 29.4s (Total time: 6286.0s)
Iteration 91 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -326.6690696066871 L_W_new: -330.3371237942508 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.757802778675447e-05 sigma_epsilon: 1.639283679142557
ESS = 969.60
Time spent on iteration: 29.2s (Total time: 6315.1s)
Iteration 92 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -330.3371237942508 L_W_new: -334.0051779818144 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.773426692846709e-05 sigma_epsilon: 1.639283679142557
ESS = 964.97
Time spent on iteration: 30.1s (Total time: 6345.2s)
Iteration 93 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -334.0051779818144 L_W_new: -337.6732321693781 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.7885434462262283e-05 sigma_epsilon: 1.639283679142557
ESS = 960.12
Time spent on iteration: 29.3s (Total time: 6374.5s)
Iteration 94 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -337.6732321693781 L_W_new: -341.3412863569418 exp(L_W_new-L_W_old): 0.025526090639360347 weight: 2.80315370224892e-05 sigma_epsilon: 1.639283679142557
ESS = 955.05
Time spent on iteration: 29.1s (Total time: 6403.5s)
Iteration 95 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -341.3412863569418 L_W_new: -345.00934054450545 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.8172584192209223e-05 sigma_epsilon: 1.639283679142557
ESS = 949.79
Time spent on iteration: 29.4s (Total time: 6432.9s)
Iteration 96 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -345.00934054450545 L_W_new: -348.6773947320691 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.8308588384933424e-05 sigma_epsilon: 1.639283679142557
ESS = 944.36
Time spent on iteration: 29.1s (Total time: 6462.0s)
Iteration 97 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -348.6773947320691 L_W_new: -352.3454489196327 exp(L_W_new-L_W_old): 0.02552609063936325 weight: 2.8439564728159435e-05 sigma_epsilon: 1.639283679142557
ESS = 938.76
Time spent on iteration: 29.8s (Total time: 6491.8s)
Iteration 98 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -352.3454489196327 L_W_new: -356.01350310719636 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.8565530948829053e-05 sigma_epsilon: 1.639283679142557
ESS = 933.01
Time spent on iteration: 29.3s (Total time: 6521.1s)
Iteration 99 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -356.01350310719636 L_W_new: -359.68155729476 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.8686507260892487e-05 sigma_epsilon: 1.639283679142557
ESS = 927.13
Time spent on iteration: 29.5s (Total time: 6550.6s)
Iteration 100 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -359.68155729476 L_W_new: -363.34961148232367 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.8802516255047642e-05 sigma_epsilon: 1.639283679142557
ESS = 921.12
Time spent on iteration: 29.2s (Total time: 6579.8s)
Iteration 101 out of 101:
Scaling_factor: 1 Logprior: -0.21224691352200786 Loglik: -366.8054187563653 L_W_old: -363.34961148232367 L_W_new: -367.0176656698873 exp(L_W_new-L_W_old): 0.0255260906393618 weight: 2.891358279080798e-05 sigma_epsilon: 1.639283679142557
ESS = 915.00
Final Resampling
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 751.9s (Total time: 7331.7s)
particles_SMC_cpi_garma_12110_tapered, diagnostics_SMC_cpi_garma_12110_tapered = smc_sampler_pro(particles_init, lb_param, ub_param,
data, model_spec,
sigma_prior, sigma_shape, sigma_scale,
delta = proposal_variance, N_bridges = N_iterations, N_updates = N_MCMC_updates,
spacing = spacing_type, resampling = True, MCMC = True, alpha=threshold,
loglik_scaling = False, verbose = True, print_diagnostic = True)
Iteration 1 out of 101:
ESS = 659.42
Time spent on iteration: 0.0s (Total time: 0.0s)
Iteration 2 out of 101:
Scaling_factor: 1 Logprior: 0.09095053211765286 Loglik: -895.975761983837 L_W_old: 0.09095053211765286 L_W_new: -8.868807087720716 exp(L_W_new-L_W_old): 0.00012847739033142324 weight: 6.772580293352535e-08 sigma_epsilon: 2.1394270893207885
ESS = 93.57
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2140.0s (Total time: 2140.0s)
Iteration 3 out of 101:
Scaling_factor: 1 Logprior: 0.6610032544533724 Loglik: -407.93941110751564 L_W_old: -3.4183908566217847 L_W_new: -7.4977849676969415 exp(L_W_new-L_W_old): 0.016917712802895345 weight: 1.6917712802895346e-05 sigma_epsilon: 1.434168138253749
ESS = 785.64
Time spent on iteration: 45.0s (Total time: 2185.0s)
Iteration 4 out of 101:
Scaling_factor: 1 Logprior: 0.6610032544533724 Loglik: -407.93941110751564 L_W_old: -7.4977849676969415 L_W_new: -11.577179078772096 exp(L_W_new-L_W_old): 0.01691771280289539 weight: 2.43221636098958e-05 sigma_epsilon: 1.434168138253749
ESS = 563.48
Time spent on iteration: 45.0s (Total time: 2230.0s)
Iteration 5 out of 101:
Scaling_factor: 1 Logprior: 0.6610032544533724 Loglik: -407.93941110751564 L_W_old: -11.577179078772096 L_W_new: -15.656573189847254 exp(L_W_new-L_W_old): 0.016917712802895318 weight: 2.7471624145317645e-05 sigma_epsilon: 1.434168138253749
ESS = 414.27
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2041.0s (Total time: 4271.0s)
Iteration 6 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -17.170557899015403 L_W_new: -21.409279864180228 exp(L_W_new-L_W_old): 0.014426017018879148 weight: 1.4426017018879148e-05 sigma_epsilon: 2.599152377730829
ESS = 944.97
Time spent on iteration: 45.4s (Total time: 4316.5s)
Iteration 7 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -21.409279864180228 L_W_new: -25.64800182934505 exp(L_W_new-L_W_old): 0.014426017018879198 weight: 1.1318736638621994e-05 sigma_epsilon: 2.599152377730829
ESS = 846.91
Time spent on iteration: 44.8s (Total time: 4361.3s)
Iteration 8 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -25.64800182934505 L_W_new: -29.886723794509876 exp(L_W_new-L_W_old): 0.014426017018879096 weight: 8.392032348183441e-06 sigma_epsilon: 2.599152377730829
ESS = 748.04
Time spent on iteration: 44.8s (Total time: 4406.1s)
Iteration 9 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -29.886723794509876 L_W_new: -34.1254457596747 exp(L_W_new-L_W_old): 0.014426017018879198 weight: 5.978690816528447e-06 sigma_epsilon: 2.599152377730829
ESS = 659.54
Time spent on iteration: 44.7s (Total time: 4450.8s)
Iteration 10 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -34.1254457596747 L_W_new: -38.36416772483952 exp(L_W_new-L_W_old): 0.014426017018879198 weight: 4.1345066521087e-06 sigma_epsilon: 2.599152377730829
ESS = 583.26
Time spent on iteration: 48.9s (Total time: 4499.7s)
Iteration 11 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -38.36416772483952 L_W_new: -42.602889690004346 exp(L_W_new-L_W_old): 0.014426017018879096 weight: 2.7939301641233523e-06 sigma_epsilon: 2.599152377730829
ESS = 518.28
Time spent on iteration: 45.0s (Total time: 4544.7s)
Iteration 12 out of 101:
Scaling_factor: 1 Logprior: -0.21567003835610457 Loglik: -423.8721965164824 L_W_old: -42.602889690004346 L_W_new: -46.84161165516917 exp(L_W_new-L_W_old): 0.014426017018879198 weight: 1.8534959206549034e-06 sigma_epsilon: 2.599152377730829
ESS = 463.02
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2196.6s (Total time: 6741.3s)
Iteration 13 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -40.642301599059266 L_W_new: -44.35793068193033 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 2.434012434246586e-05 sigma_epsilon: 1.9517627461383849
ESS = 988.23
Time spent on iteration: 51.0s (Total time: 6792.4s)
Iteration 14 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -44.35793068193033 L_W_new: -48.07355976480139 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 2.650540206466995e-05 sigma_epsilon: 1.9517627461383849
ESS = 960.57
Time spent on iteration: 50.4s (Total time: 6842.7s)
Iteration 15 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -48.07355976480139 L_W_new: -51.78918884767245 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 2.8523546907949563e-05 sigma_epsilon: 1.9517627461383849
ESS = 924.66
Time spent on iteration: 48.8s (Total time: 6891.6s)
Iteration 16 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -51.78918884767245 L_W_new: -55.5048179305435 exp(L_W_new-L_W_old): 0.024340124342466032 weight: 3.0391433655309136e-05 sigma_epsilon: 1.9517627461383849
ESS = 884.83
Time spent on iteration: 46.5s (Total time: 6938.1s)
Iteration 17 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -55.5048179305435 L_W_new: -59.220447013414564 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 3.210789633276577e-05 sigma_epsilon: 1.9517627461383849
ESS = 843.53
Time spent on iteration: 45.8s (Total time: 6983.8s)
Iteration 18 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -59.220447013414564 L_W_new: -62.93607609628563 exp(L_W_new-L_W_old): 0.024340124342465685 weight: 3.367310148178261e-05 sigma_epsilon: 1.9517627461383849
ESS = 802.20
Time spent on iteration: 49.8s (Total time: 7033.6s)
Iteration 19 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -62.93607609628563 L_W_new: -66.65170517915669 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 3.508819814762991e-05 sigma_epsilon: 1.9517627461383849
ESS = 761.67
Time spent on iteration: 51.0s (Total time: 7084.7s)
Iteration 20 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -66.65170517915669 L_W_new: -70.36733426202775 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 3.635511980994146e-05 sigma_epsilon: 1.9517627461383849
ESS = 722.40
Time spent on iteration: 51.2s (Total time: 7135.9s)
Iteration 21 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -70.36733426202775 L_W_new: -74.08296334489881 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 3.74764660457904e-05 sigma_epsilon: 1.9517627461383849
ESS = 684.68
Time spent on iteration: 50.3s (Total time: 7186.2s)
Iteration 22 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -74.08296334489881 L_W_new: -77.79859242776986 exp(L_W_new-L_W_old): 0.024340124342466206 weight: 3.845542303162851e-05 sigma_epsilon: 1.9517627461383849
ESS = 648.62
Time spent on iteration: 45.8s (Total time: 7232.0s)
Iteration 23 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -77.79859242776986 L_W_new: -81.51422151064092 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 3.9295700722016526e-05 sigma_epsilon: 1.9517627461383849
ESS = 614.27
Time spent on iteration: 49.2s (Total time: 7281.2s)
Iteration 24 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -81.51422151064092 L_W_new: -85.229850593512 exp(L_W_new-L_W_old): 0.024340124342465515 weight: 4.0001475627732856e-05 sigma_epsilon: 1.9517627461383849
ESS = 581.62
Time spent on iteration: 48.0s (Total time: 7329.2s)
Iteration 25 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -85.229850593512 L_W_new: -88.94547967638304 exp(L_W_new-L_W_old): 0.024340124342466206 weight: 4.057733445877534e-05 sigma_epsilon: 1.9517627461383849
ESS = 550.64
Time spent on iteration: 49.8s (Total time: 7378.9s)
Iteration 26 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -88.94547967638304 L_W_new: -92.6611087592541 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 4.1028217308027354e-05 sigma_epsilon: 1.9517627461383849
ESS = 521.26
Time spent on iteration: 49.0s (Total time: 7427.9s)
Iteration 27 out of 101:
Scaling_factor: 1 Logprior: 0.22961831252238266 Loglik: -371.5629082871059 L_W_old: -92.6611087592541 L_W_new: -96.37673784212517 exp(L_W_new-L_W_old): 0.02434012434246586 weight: 4.135936069622285e-05 sigma_epsilon: 1.9517627461383849
ESS = 493.40
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2226.1s (Total time: 9654.0s)
Iteration 28 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -96.14657607421037 L_W_new: -99.85969424626029 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.440131701658918e-05 sigma_epsilon: 1.7430075086432852
ESS = 997.42
Time spent on iteration: 47.6s (Total time: 9701.6s)
Iteration 29 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -99.85969424626029 L_W_new: -103.57281241831019 exp(L_W_new-L_W_old): 0.024401317016589527 weight: 2.4533542749230582e-05 sigma_epsilon: 1.7430075086432852
ESS = 990.27
Time spent on iteration: 47.9s (Total time: 9749.5s)
Iteration 30 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -103.57281241831019 L_W_new: -107.28593059036008 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 2.460292331189375e-05 sigma_epsilon: 1.7430075086432852
ESS = 979.32
Time spent on iteration: 49.5s (Total time: 9799.0s)
Iteration 31 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -107.28593059036008 L_W_new: -110.99904876241 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.4612317836026328e-05 sigma_epsilon: 1.7430075086432852
ESS = 965.28
Time spent on iteration: 49.0s (Total time: 9848.0s)
Iteration 32 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -110.99904876241 L_W_new: -114.7121669344599 exp(L_W_new-L_W_old): 0.024401317016589527 weight: 2.4564784712654144e-05 sigma_epsilon: 1.7430075086432852
ESS = 948.71
Time spent on iteration: 49.5s (Total time: 9897.5s)
Iteration 33 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -114.7121669344599 L_W_new: -118.42528510650982 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.446352620431903e-05 sigma_epsilon: 1.7430075086432852
ESS = 930.14
Time spent on iteration: 46.2s (Total time: 9943.8s)
Iteration 34 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -118.42528510650982 L_W_new: -122.13840327855972 exp(L_W_new-L_W_old): 0.024401317016589527 weight: 2.4311840676486834e-05 sigma_epsilon: 1.7430075086432852
ESS = 909.97
Time spent on iteration: 44.8s (Total time: 9988.6s)
Iteration 35 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -122.13840327855972 L_W_new: -125.85152145060962 exp(L_W_new-L_W_old): 0.024401317016589527 weight: 2.4113081626507485e-05 sigma_epsilon: 1.7430075086432852
ESS = 888.57
Time spent on iteration: 45.2s (Total time: 10033.8s)
Iteration 36 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -125.85152145060962 L_W_new: -129.5646396226595 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 2.3870622708852185e-05 sigma_epsilon: 1.7430075086432852
ESS = 866.24
Time spent on iteration: 44.6s (Total time: 10078.4s)
Iteration 37 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -129.5646396226595 L_W_new: -133.2777577947094 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 2.3587828011409718e-05 sigma_epsilon: 1.7430075086432852
ESS = 843.23
Time spent on iteration: 44.9s (Total time: 10123.3s)
Iteration 38 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -133.2777577947094 L_W_new: -136.99087596675932 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.3268026911328026e-05 sigma_epsilon: 1.7430075086432852
ESS = 819.74
Time spent on iteration: 45.5s (Total time: 10168.8s)
Iteration 39 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -136.99087596675932 L_W_new: -140.70399413880924 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.2914492918148628e-05 sigma_epsilon: 1.7430075086432852
ESS = 795.96
Time spent on iteration: 45.0s (Total time: 10213.8s)
Iteration 40 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -140.70399413880924 L_W_new: -144.41711231085915 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.2530425989232793e-05 sigma_epsilon: 1.7430075086432852
ESS = 772.03
Time spent on iteration: 45.7s (Total time: 10259.5s)
Iteration 41 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -144.41711231085915 L_W_new: -148.13023048290904 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 2.2118937873475344e-05 sigma_epsilon: 1.7430075086432852
ESS = 748.07
Time spent on iteration: 44.5s (Total time: 10304.0s)
Iteration 42 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -148.13023048290904 L_W_new: -151.84334865495896 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.1683040101925323e-05 sigma_epsilon: 1.7430075086432852
ESS = 724.19
Time spent on iteration: 44.7s (Total time: 10348.6s)
Iteration 43 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -151.84334865495896 L_W_new: -155.55646682700885 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 2.122563429776643e-05 sigma_epsilon: 1.7430075086432852
ESS = 700.46
Time spent on iteration: 45.2s (Total time: 10393.8s)
Iteration 44 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -155.55646682700885 L_W_new: -159.26958499905876 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 2.074950452339994e-05 sigma_epsilon: 1.7430075086432852
ESS = 676.96
Time spent on iteration: 44.9s (Total time: 10438.7s)
Iteration 45 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -159.26958499905876 L_W_new: -162.98270317110865 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 2.025731142012179e-05 sigma_epsilon: 1.7430075086432852
ESS = 653.75
Time spent on iteration: 44.9s (Total time: 10483.6s)
Iteration 46 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -162.98270317110865 L_W_new: -166.69582134315857 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 1.9751587926983784e-05 sigma_epsilon: 1.7430075086432852
ESS = 630.87
Time spent on iteration: 45.2s (Total time: 10528.8s)
Iteration 47 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -166.69582134315857 L_W_new: -170.4089395152085 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 1.9234736391191713e-05 sigma_epsilon: 1.7430075086432852
ESS = 608.35
Time spent on iteration: 45.5s (Total time: 10574.3s)
Iteration 48 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -170.4089395152085 L_W_new: -174.1220576872584 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 1.8709026903623667e-05 sigma_epsilon: 1.7430075086432852
ESS = 586.24
Time spent on iteration: 44.7s (Total time: 10619.1s)
Iteration 49 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -174.1220576872584 L_W_new: -177.8351758593083 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 1.8176596710857626e-05 sigma_epsilon: 1.7430075086432852
ESS = 564.55
Time spent on iteration: 44.7s (Total time: 10663.7s)
Iteration 50 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -177.8351758593083 L_W_new: -181.54829403135818 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 1.7639450570093312e-05 sigma_epsilon: 1.7430075086432852
ESS = 543.30
Time spent on iteration: 44.6s (Total time: 10708.3s)
Iteration 51 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -181.54829403135818 L_W_new: -185.2614122034081 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 1.709946192624622e-05 sigma_epsilon: 1.7430075086432852
ESS = 522.52
Time spent on iteration: 44.7s (Total time: 10753.0s)
Iteration 52 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -185.2614122034081 L_W_new: -188.97453037545802 exp(L_W_new-L_W_old): 0.02440131701658918 weight: 1.655837480170374e-05 sigma_epsilon: 1.7430075086432852
ESS = 502.20
Time spent on iteration: 44.6s (Total time: 10797.6s)
Iteration 53 out of 101:
Scaling_factor: 1 Logprior: 0.3944963990871795 Loglik: -371.3118172049906 L_W_old: -188.97453037545802 L_W_new: -192.6876485475079 exp(L_W_new-L_W_old): 0.024401317016589874 weight: 1.601780629919431e-05 sigma_epsilon: 1.7430075086432852
ESS = 482.36
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2220.7s (Total time: 13018.3s)
Iteration 54 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -191.04802907749112 L_W_new: -194.729102734671 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.5195908539759066e-05 sigma_epsilon: 1.775814727223683
ESS = 999.05
Time spent on iteration: 49.4s (Total time: 13067.7s)
Iteration 55 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -194.729102734671 L_W_new: -198.41017639185088 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.5093297526356246e-05 sigma_epsilon: 1.775814727223683
ESS = 996.31
Time spent on iteration: 48.5s (Total time: 13116.2s)
Iteration 56 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -198.41017639185088 L_W_new: -202.09125004903075 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.4967402560178416e-05 sigma_epsilon: 1.775814727223683
ESS = 991.90
Time spent on iteration: 49.3s (Total time: 13165.5s)
Iteration 57 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -202.09125004903075 L_W_new: -205.77232370621064 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.4819170540076345e-05 sigma_epsilon: 1.775814727223683
ESS = 985.98
Time spent on iteration: 50.5s (Total time: 13216.0s)
Iteration 58 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -205.77232370621064 L_W_new: -209.4533973633905 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.4649565429898294e-05 sigma_epsilon: 1.775814727223683
ESS = 978.66
Time spent on iteration: 51.4s (Total time: 13267.4s)
Iteration 59 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -209.4533973633905 L_W_new: -213.13447102057037 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.4459563593849227e-05 sigma_epsilon: 1.775814727223683
ESS = 970.07
Time spent on iteration: 50.7s (Total time: 13318.2s)
Iteration 60 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -213.13447102057037 L_W_new: -216.81554467775024 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.4250149547259718e-05 sigma_epsilon: 1.775814727223683
ESS = 960.30
Time spent on iteration: 48.0s (Total time: 13366.1s)
Iteration 61 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -216.81554467775024 L_W_new: -220.49661833493013 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.402231209488931e-05 sigma_epsilon: 1.775814727223683
ESS = 949.46
Time spent on iteration: 50.1s (Total time: 13416.2s)
Iteration 62 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -220.49661833493013 L_W_new: -224.17769199211 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.377704082884382e-05 sigma_epsilon: 1.775814727223683
ESS = 937.64
Time spent on iteration: 52.6s (Total time: 13468.8s)
Iteration 63 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -224.17769199211 L_W_new: -227.8587656492899 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.351532295873914e-05 sigma_epsilon: 1.775814727223683
ESS = 924.93
Time spent on iteration: 50.1s (Total time: 13518.9s)
Iteration 64 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -227.8587656492899 L_W_new: -231.53983930646976 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.3238140447707978e-05 sigma_epsilon: 1.775814727223683
ESS = 911.41
Time spent on iteration: 52.8s (Total time: 13571.7s)
Iteration 65 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -231.53983930646976 L_W_new: -235.22091296364962 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.294646742910073e-05 sigma_epsilon: 1.775814727223683
ESS = 897.16
Time spent on iteration: 53.4s (Total time: 13625.1s)
Iteration 66 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -235.22091296364962 L_W_new: -238.90198662082952 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.2641267880252362e-05 sigma_epsilon: 1.775814727223683
ESS = 882.24
Time spent on iteration: 50.8s (Total time: 13676.0s)
Iteration 67 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -238.90198662082952 L_W_new: -242.58306027800938 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.232349353126702e-05 sigma_epsilon: 1.775814727223683
ESS = 866.72
Time spent on iteration: 49.0s (Total time: 13725.0s)
Iteration 68 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -242.58306027800938 L_W_new: -246.26413393518928 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.199408198844159e-05 sigma_epsilon: 1.775814727223683
ESS = 850.68
Time spent on iteration: 50.6s (Total time: 13775.6s)
Iteration 69 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -246.26413393518928 L_W_new: -249.94520759236914 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 2.1653955053642132e-05 sigma_epsilon: 1.775814727223683
ESS = 834.16
Time spent on iteration: 51.3s (Total time: 13826.9s)
Iteration 70 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -249.94520759236914 L_W_new: -253.62628124954904 exp(L_W_new-L_W_old): 0.02519590853975835 weight: 2.1304017222553548e-05 sigma_epsilon: 1.775814727223683
ESS = 817.22
Time spent on iteration: 50.4s (Total time: 13877.3s)
Iteration 71 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -253.62628124954904 L_W_new: -257.30735490672896 exp(L_W_new-L_W_old): 0.025195908539757634 weight: 2.0945154346337123e-05 sigma_epsilon: 1.775814727223683
ESS = 799.93
Time spent on iteration: 52.7s (Total time: 13930.0s)
Iteration 72 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -257.30735490672896 L_W_new: -260.98842856390877 exp(L_W_new-L_W_old): 0.0251959085397605 weight: 2.057823244269908e-05 sigma_epsilon: 1.775814727223683
ESS = 782.33
Time spent on iteration: 52.1s (Total time: 13982.1s)
Iteration 73 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -260.98842856390877 L_W_new: -264.6695022210887 exp(L_W_new-L_W_old): 0.025195908539757634 weight: 2.0204096643773976e-05 sigma_epsilon: 1.775814727223683
ESS = 764.48
Time spent on iteration: 49.6s (Total time: 14031.7s)
Iteration 74 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -264.6695022210887 L_W_new: -268.35057587826856 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.9823570269579032e-05 sigma_epsilon: 1.775814727223683
ESS = 746.42
Time spent on iteration: 51.0s (Total time: 14082.7s)
Iteration 75 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -268.35057587826856 L_W_new: -272.0316495354484 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.9437454016875057e-05 sigma_epsilon: 1.775814727223683
ESS = 728.20
Time spent on iteration: 49.3s (Total time: 14132.0s)
Iteration 76 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -272.0316495354484 L_W_new: -275.7127231926283 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.9046525254484815e-05 sigma_epsilon: 1.775814727223683
ESS = 709.87
Time spent on iteration: 49.0s (Total time: 14181.0s)
Iteration 77 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -275.7127231926283 L_W_new: -279.39379684980815 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.8651537416995754e-05 sigma_epsilon: 1.775814727223683
ESS = 691.46
Time spent on iteration: 50.2s (Total time: 14231.2s)
Iteration 78 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -279.39379684980815 L_W_new: -283.0748705069881 exp(L_W_new-L_W_old): 0.025195908539757634 weight: 1.8253219489701296e-05 sigma_epsilon: 1.775814727223683
ESS = 673.03
Time spent on iteration: 49.2s (Total time: 14280.4s)
Iteration 79 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -283.0748705069881 L_W_new: -286.75594416416794 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.7852275578407046e-05 sigma_epsilon: 1.775814727223683
ESS = 654.61
Time spent on iteration: 48.7s (Total time: 14329.1s)
Iteration 80 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -286.75594416416794 L_W_new: -290.4370178213478 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.7449384558399253e-05 sigma_epsilon: 1.775814727223683
ESS = 636.24
Time spent on iteration: 49.9s (Total time: 14379.0s)
Iteration 81 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -290.4370178213478 L_W_new: -294.1180914785277 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.7045199797516768e-05 sigma_epsilon: 1.775814727223683
ESS = 617.96
Time spent on iteration: 50.1s (Total time: 14429.1s)
Iteration 82 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -294.1180914785277 L_W_new: -297.7991651357076 exp(L_W_new-L_W_old): 0.025195908539757634 weight: 1.664034894875745e-05 sigma_epsilon: 1.775814727223683
ESS = 599.80
Time spent on iteration: 51.4s (Total time: 14480.4s)
Iteration 83 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -297.7991651357076 L_W_new: -301.48023879288746 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.623543380834055e-05 sigma_epsilon: 1.775814727223683
ESS = 581.79
Time spent on iteration: 51.5s (Total time: 14531.9s)
Iteration 84 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -301.48023879288746 L_W_new: -305.1613124500673 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.5831030235510715e-05 sigma_epsilon: 1.775814727223683
ESS = 563.97
Time spent on iteration: 49.2s (Total time: 14581.1s)
Iteration 85 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -305.1613124500673 L_W_new: -308.8423861072472 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.542768813074557e-05 sigma_epsilon: 1.775814727223683
ESS = 546.36
Time spent on iteration: 49.8s (Total time: 14630.9s)
Iteration 86 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -308.8423861072472 L_W_new: -312.52345976442706 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.5025931469275143e-05 sigma_epsilon: 1.775814727223683
ESS = 529.00
Time spent on iteration: 50.3s (Total time: 14681.3s)
Iteration 87 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -312.52345976442706 L_W_new: -316.2045334216069 exp(L_W_new-L_W_old): 0.025195908539759067 weight: 1.4626258387089413e-05 sigma_epsilon: 1.775814727223683
ESS = 511.90
Time spent on iteration: 51.9s (Total time: 14733.2s)
Iteration 88 out of 101:
Scaling_factor: 1 Logprior: 0.36780109586245535 Loglik: -368.10736571798765 L_W_old: -316.2045334216069 L_W_new: -319.88560707878685 exp(L_W_new-L_W_old): 0.025195908539757634 weight: 1.4229141316786502e-05 sigma_epsilon: 1.775814727223683
ESS = 495.09
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2211.6s (Total time: 16944.8s)
Iteration 89 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -314.88708597514295 L_W_new: -318.5103054591066 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 2.6696588748581767e-05 sigma_epsilon: 1.8191329575005706
ESS = 999.45
Time spent on iteration: 45.4s (Total time: 16990.2s)
Iteration 90 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -318.5103054591066 L_W_new: -322.1335249430702 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 2.7500730417656637e-05 sigma_epsilon: 1.8191329575005706
ESS = 997.81
Time spent on iteration: 46.0s (Total time: 17036.1s)
Iteration 91 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -322.1335249430702 L_W_new: -325.7567444270338 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 2.8313458234833618e-05 sigma_epsilon: 1.8191329575005706
ESS = 995.11
Time spent on iteration: 45.1s (Total time: 17081.2s)
Iteration 92 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -325.7567444270338 L_W_new: -329.37996391099745 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 2.9134232272128525e-05 sigma_epsilon: 1.8191329575005706
ESS = 991.39
Time spent on iteration: 60.8s (Total time: 17142.1s)
Iteration 93 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -329.37996391099745 L_W_new: -333.00318339496107 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 2.9962491419176587e-05 sigma_epsilon: 1.8191329575005706
ESS = 986.68
Time spent on iteration: 47.7s (Total time: 17189.8s)
Iteration 94 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -333.00318339496107 L_W_new: -336.62640287892475 exp(L_W_new-L_W_old): 0.026696588748580247 weight: 3.079765424579168e-05 sigma_epsilon: 1.8191329575005706
ESS = 981.01
Time spent on iteration: 51.0s (Total time: 17240.8s)
Iteration 95 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -336.62640287892475 L_W_new: -340.2496223628884 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 3.163911994296943e-05 sigma_epsilon: 1.8191329575005706
ESS = 974.41
Time spent on iteration: 51.3s (Total time: 17292.1s)
Iteration 96 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -340.2496223628884 L_W_new: -343.872841846852 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 3.24862693397081e-05 sigma_epsilon: 1.8191329575005706
ESS = 966.95
Time spent on iteration: 54.0s (Total time: 17346.2s)
Iteration 97 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -343.872841846852 L_W_new: -347.49606133081556 exp(L_W_new-L_W_old): 0.026696588748583282 weight: 3.333846599261773e-05 sigma_epsilon: 1.8191329575005706
ESS = 958.64
Time spent on iteration: 49.6s (Total time: 17395.8s)
Iteration 98 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -347.49606133081556 L_W_new: -351.11928081477924 exp(L_W_new-L_W_old): 0.026696588748580247 weight: 3.4195057344759326e-05 sigma_epsilon: 1.8191329575005706
ESS = 949.54
Time spent on iteration: 47.2s (Total time: 17443.0s)
Iteration 99 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -351.11928081477924 L_W_new: -354.74250029874287 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 3.505537594982249e-05 sigma_epsilon: 1.8191329575005706
ESS = 939.70
Time spent on iteration: 46.8s (Total time: 17489.8s)
Iteration 100 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -354.74250029874287 L_W_new: -358.3657197827065 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 3.591874075719023e-05 sigma_epsilon: 1.8191329575005706
ESS = 929.16
Time spent on iteration: 49.3s (Total time: 17539.1s)
Iteration 101 out of 101:
Scaling_factor: 1 Logprior: 0.333009129692844 Loglik: -362.321948396363 L_W_old: -358.3657197827065 L_W_new: -361.9889392666701 exp(L_W_new-L_W_old): 0.026696588748581766 weight: 3.6784458453236866e-05 sigma_epsilon: 1.8191329575005706
ESS = 917.97
Final Resampling
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2299.1s (Total time: 19838.2s)
particles_SMC_cpi_garma_10112_tapered, diagnostics_SMC_cpi_garma_10112_tapered = smc_sampler_pro(particles_init, lb_param, ub_param,
data, model_spec,
sigma_prior, sigma_shape, sigma_scale,
delta = proposal_variance, N_bridges = N_iterations, N_updates = N_MCMC_updates,
spacing = spacing_type, resampling = True, MCMC = True, alpha=threshold,
loglik_scaling = False, verbose = True, print_diagnostic = True)
Iteration 1 out of 101:
ESS = 654.93
Time spent on iteration: 0.0s (Total time: 0.0s)
Iteration 2 out of 101:
Scaling_factor: 1 Logprior: -0.23657534262698515 Loglik: -2706.0857309163416 L_W_old: -0.23657534262698515 L_W_new: -27.297432651790402 exp(L_W_new-L_W_old): 1.768556729264265e-12 weight: 2.6700951651315858e-15 sigma_epsilon: 0.9295927700675453
ESS = 146.92
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1879.9s (Total time: 1879.9s)
Iteration 3 out of 101:
Scaling_factor: 1 Logprior: -0.5519301157810182 Loglik: -464.1029459085848 L_W_old: -5.192959574866866 L_W_new: -9.833989033952715 exp(L_W_new-L_W_old): 0.009647760538757488 weight: 9.647760538757488e-06 sigma_epsilon: 1.2487399966557837
ESS = 796.73
Time spent on iteration: 41.0s (Total time: 1920.9s)
Iteration 4 out of 101:
Scaling_factor: 1 Logprior: -0.5519301157810182 Loglik: -464.1029459085848 L_W_old: -9.833989033952715 L_W_new: -14.475018493038561 exp(L_W_new-L_W_old): 0.009647760538757514 weight: 8.728388736117349e-06 sigma_epsilon: 1.2487399966557837
ESS = 574.55
Time spent on iteration: 40.5s (Total time: 1961.4s)
Iteration 5 out of 101:
Scaling_factor: 1 Logprior: -0.5519301157810182 Loglik: -464.1029459085848 L_W_old: -14.475018493038561 L_W_new: -19.11604795212441 exp(L_W_new-L_W_old): 0.00964776053875748 weight: 6.291447199040962e-06 sigma_epsilon: 1.2487399966557837
ESS = 415.90
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1862.3s (Total time: 3823.8s)
Iteration 6 out of 101:
Scaling_factor: 1 Logprior: -1.0667881237409598 Loglik: -378.64832555072104 L_W_old: -16.2127211457698 L_W_new: -19.999204401277012 exp(L_W_new-L_W_old): 0.022675204698890696 weight: 2.2675204698890697e-05 sigma_epsilon: 1.836119107244799
ESS = 943.39
Time spent on iteration: 44.8s (Total time: 3868.6s)
Iteration 7 out of 101:
Scaling_factor: 1 Logprior: -1.0667881237409598 Loglik: -378.64832555072104 L_W_old: -19.999204401277012 L_W_new: -23.785687656784223 exp(L_W_new-L_W_old): 0.022675204698890696 weight: 3.090511241676852e-05 sigma_epsilon: 1.836119107244799
ESS = 836.39
Time spent on iteration: 44.6s (Total time: 3913.1s)
Iteration 8 out of 101:
Scaling_factor: 1 Logprior: -1.0667881237409598 Loglik: -378.64832555072104 L_W_old: -23.785687656784223 L_W_new: -27.572170912291433 exp(L_W_new-L_W_old): 0.022675204698890696 weight: 3.973747469052159e-05 sigma_epsilon: 1.836119107244799
ESS = 723.05
Time spent on iteration: 43.5s (Total time: 3956.6s)
Iteration 9 out of 101:
Scaling_factor: 1 Logprior: -1.0667881237409598 Loglik: -378.64832555072104 L_W_old: -27.572170912291433 L_W_new: -31.358654167798644 exp(L_W_new-L_W_old): 0.022675204698890696 weight: 4.8929038759543676e-05 sigma_epsilon: 1.836119107244799
ESS = 617.08
Time spent on iteration: 44.0s (Total time: 4000.7s)
Iteration 10 out of 101:
Scaling_factor: 1 Logprior: -1.0667881237409598 Loglik: -378.64832555072104 L_W_old: -31.358654167798644 L_W_new: -35.145137423305854 exp(L_W_new-L_W_old): 0.022675204698890696 weight: 5.82451139961605e-05 sigma_epsilon: 1.836119107244799
ESS = 522.25
Time spent on iteration: 43.6s (Total time: 4044.2s)
Iteration 11 out of 101:
Scaling_factor: 1 Logprior: -1.0667881237409598 Loglik: -378.64832555072104 L_W_old: -35.145137423305854 L_W_new: -38.93162067881307 exp(L_W_new-L_W_old): 0.022675204698890616 weight: 6.745587642065066e-05 sigma_epsilon: 1.836119107244799
ESS = 438.86
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2018.0s (Total time: 6062.2s)
Iteration 12 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -40.7336495198392 L_W_new: -44.67432899176385 exp(L_W_new-L_W_old): 0.019435004717910903 weight: 1.9435004717910903e-05 sigma_epsilon: 2.1837315054085438
ESS = 982.29
Time spent on iteration: 43.7s (Total time: 6105.9s)
Iteration 13 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -44.67432899176385 L_W_new: -48.615008463688504 exp(L_W_new-L_W_old): 0.019435004717910903 weight: 1.845118935292006e-05 sigma_epsilon: 2.1837315054085438
ESS = 937.44
Time spent on iteration: 45.0s (Total time: 6150.9s)
Iteration 14 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -48.615008463688504 L_W_new: -52.55568793561316 exp(L_W_new-L_W_old): 0.019435004717910903 weight: 1.720701859702071e-05 sigma_epsilon: 2.1837315054085438
ESS = 875.59
Time spent on iteration: 43.3s (Total time: 6194.2s)
Iteration 15 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -52.55568793561316 L_W_new: -56.49636740753782 exp(L_W_new-L_W_old): 0.019435004717910764 weight: 1.5790964122822234e-05 sigma_epsilon: 2.1837315054085438
ESS = 804.31
Time spent on iteration: 45.0s (Total time: 6239.2s)
Iteration 16 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -56.49636740753782 L_W_new: -60.437046879462464 exp(L_W_new-L_W_old): 0.019435004717911042 weight: 1.4281447635688151e-05 sigma_epsilon: 2.1837315054085438
ESS = 729.08
Time spent on iteration: 48.5s (Total time: 6287.7s)
Iteration 17 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -60.437046879462464 L_W_new: -64.37772635138711 exp(L_W_new-L_W_old): 0.019435004717911042 weight: 1.2744707355032731e-05 sigma_epsilon: 2.1837315054085438
ESS = 653.65
Time spent on iteration: 48.2s (Total time: 6335.8s)
Iteration 18 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -64.37772635138711 L_W_new: -68.31840582331178 exp(L_W_new-L_W_old): 0.019435004717910626 weight: 1.1233996160396638e-05 sigma_epsilon: 2.1837315054085438
ESS = 580.52
Time spent on iteration: 45.2s (Total time: 6381.1s)
Iteration 19 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -68.31840582331178 L_W_new: -72.25908529523643 exp(L_W_new-L_W_old): 0.019435004717910903 weight: 9.789803940217888e-06 sigma_epsilon: 2.1837315054085438
ESS = 511.29
Time spent on iteration: 43.8s (Total time: 6424.9s)
Iteration 20 out of 101:
Scaling_factor: 1 Logprior: -1.3268548005926544 Loglik: -394.0679471924654 L_W_old: -72.25908529523643 L_W_new: -76.19976476716108 exp(L_W_new-L_W_old): 0.019435004717910903 weight: 8.440824583167644e-06 sigma_epsilon: 2.1837315054085438
ESS = 446.93
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 2042.8s (Total time: 8467.7s)
Iteration 21 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -73.09409838250372 L_W_new: -76.87571969399548 exp(L_W_new-L_W_old): 0.022785718713452703 weight: 2.2785718713452704e-05 sigma_epsilon: 2.0676150971882206
ESS = 990.79
Time spent on iteration: 46.3s (Total time: 8514.0s)
Iteration 22 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -76.87571969399548 L_W_new: -80.65734100548723 exp(L_W_new-L_W_old): 0.02278571871345303 weight: 2.248821246013142e-05 sigma_epsilon: 2.0676150971882206
ESS = 963.46
Time spent on iteration: 43.7s (Total time: 8557.7s)
Iteration 23 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -80.65734100548723 L_W_new: -84.43896231697899 exp(L_W_new-L_W_old): 0.022785718713452703 weight: 2.199021021380092e-05 sigma_epsilon: 2.0676150971882206
ESS = 918.85
Time spent on iteration: 42.5s (Total time: 8600.2s)
Iteration 24 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -84.43896231697899 L_W_new: -88.22058362847073 exp(L_W_new-L_W_old): 0.02278571871345303 weight: 2.130429714766744e-05 sigma_epsilon: 2.0676150971882206
ESS = 858.61
Time spent on iteration: 41.1s (Total time: 8641.3s)
Iteration 25 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -88.22058362847073 L_W_new: -92.00220493996248 exp(L_W_new-L_W_old): 0.02278571871345303 weight: 2.0447051621178238e-05 sigma_epsilon: 2.0676150971882206
ESS = 785.52
Time spent on iteration: 40.8s (Total time: 8682.1s)
Iteration 26 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -92.00220493996248 L_W_new: -95.78382625145424 exp(L_W_new-L_W_old): 0.022785718713452703 weight: 1.9438715199406594e-05 sigma_epsilon: 2.0676150971882206
ESS = 703.55
Time spent on iteration: 40.4s (Total time: 8722.4s)
Iteration 27 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -95.78382625145424 L_W_new: -99.565447562946 exp(L_W_new-L_W_old): 0.022785718713452703 weight: 1.8302746725608493e-05 sigma_epsilon: 2.0676150971882206
ESS = 617.46
Time spent on iteration: 40.5s (Total time: 8762.9s)
Iteration 28 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -99.565447562946 L_W_new: -103.34706887443775 exp(L_W_new-L_W_old): 0.02278571871345303 weight: 1.706523001641524e-05 sigma_epsilon: 2.0676150971882206
ESS = 532.13
Time spent on iteration: 40.2s (Total time: 8803.1s)
Iteration 29 out of 101:
Scaling_factor: 1 Logprior: -1.243293464160384 Loglik: -378.1621311491754 L_W_old: -103.34706887443775 L_W_new: -107.12869018592951 exp(L_W_new-L_W_old): 0.022785718713452703 weight: 1.5754116329835777e-05 sigma_epsilon: 2.0676150971882206
ESS = 451.72
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1851.7s (Total time: 10654.8s)
Iteration 30 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -107.0827097546898 L_W_new: -110.87979675991703 exp(L_W_new-L_W_old): 0.022436032803897478 weight: 2.2436032803897477e-05 sigma_epsilon: 1.4773871081454206
ESS = 990.75
Time spent on iteration: 40.7s (Total time: 10695.5s)
Iteration 31 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -110.87979675991703 L_W_new: -114.67688376514427 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 1.9923738303278745e-05 sigma_epsilon: 1.4773871081454206
ESS = 963.85
Time spent on iteration: 41.2s (Total time: 10736.7s)
Iteration 32 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -114.67688376514427 L_W_new: -118.47397077037151 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 1.7529148951349696e-05 sigma_epsilon: 1.4773871081454206
ESS = 921.74
Time spent on iteration: 39.8s (Total time: 10776.5s)
Iteration 33 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -118.47397077037151 L_W_new: -122.27105777559875 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 1.5280862036134874e-05 sigma_epsilon: 1.4773871081454206
ESS = 868.09
Time spent on iteration: 40.2s (Total time: 10816.6s)
Iteration 34 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -122.27105777559875 L_W_new: -126.06814478082599 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 1.320038767460775e-05 sigma_epsilon: 1.4773871081454206
ESS = 807.13
Time spent on iteration: 40.4s (Total time: 10857.0s)
Iteration 35 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -126.06814478082599 L_W_new: -129.86523178605324 exp(L_W_new-L_W_old): 0.02243603280389684 weight: 1.1302028698250785e-05 sigma_epsilon: 1.4773871081454206
ESS = 742.93
Time spent on iteration: 40.7s (Total time: 10897.8s)
Iteration 36 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -129.86523178605324 L_W_new: -133.66231879128048 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 9.593127973776664e-06 sigma_epsilon: 1.4773871081454206
ESS = 678.88
Time spent on iteration: 40.3s (Total time: 10938.0s)
Iteration 37 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -133.66231879128048 L_W_new: -137.4594057965077 exp(L_W_new-L_W_old): 0.022436032803897797 weight: 8.074655751301844e-06 sigma_epsilon: 1.4773871081454206
ESS = 617.45
Time spent on iteration: 40.8s (Total time: 10978.9s)
Iteration 38 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -137.4594057965077 L_W_new: -141.25649280173494 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 6.742072974866084e-06 sigma_epsilon: 1.4773871081454206
ESS = 560.16
Time spent on iteration: 40.3s (Total time: 11019.2s)
Iteration 39 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -141.25649280173494 L_W_new: -145.05357980696218 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 5.586380056631758e-06 sigma_epsilon: 1.4773871081454206
ESS = 507.78
Time spent on iteration: 41.4s (Total time: 11060.5s)
Iteration 40 out of 101:
Scaling_factor: 1 Logprior: -0.7642736083271492 Loglik: -379.70870052272375 L_W_old: -145.05357980696218 L_W_new: -148.85066681218942 exp(L_W_new-L_W_old): 0.02243603280389716 weight: 4.5952492043549956e-06 sigma_epsilon: 1.4773871081454206
ESS = 460.48
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1838.7s (Total time: 12899.2s)
Iteration 41 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -139.58388017942244 L_W_new: -143.1345830433426 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.8704457234985163e-05 sigma_epsilon: 1.8866116371982664
ESS = 994.35
Time spent on iteration: 41.0s (Total time: 12940.2s)
Iteration 42 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -143.1345830433426 L_W_new: -146.68528590726274 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.95025092717467e-05 sigma_epsilon: 1.8866116371982664
ESS = 979.00
Time spent on iteration: 40.4s (Total time: 12980.6s)
Iteration 43 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -146.68528590726274 L_W_new: -150.23598877118286 exp(L_W_new-L_W_old): 0.028704457234985978 weight: 3.015152767415413e-05 sigma_epsilon: 1.8866116371982664
ESS = 956.28
Time spent on iteration: 40.6s (Total time: 13021.2s)
Iteration 44 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -150.23598877118286 L_W_new: -153.786691635103 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 3.0651877124910953e-05 sigma_epsilon: 1.8866116371982664
ESS = 928.28
Time spent on iteration: 40.1s (Total time: 13061.3s)
Iteration 45 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -153.786691635103 L_W_new: -157.3373944990232 exp(L_W_new-L_W_old): 0.028704457234984347 weight: 3.100648477211283e-05 sigma_epsilon: 1.8866116371982664
ESS = 896.73
Time spent on iteration: 40.3s (Total time: 13101.6s)
Iteration 46 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -157.3373944990232 L_W_new: -160.88809736294334 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 3.1220392184493346e-05 sigma_epsilon: 1.8866116371982664
ESS = 863.00
Time spent on iteration: 40.0s (Total time: 13141.5s)
Iteration 47 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -160.88809736294334 L_W_new: -164.4388002268635 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 3.130030771140492e-05 sigma_epsilon: 1.8866116371982664
ESS = 828.08
Time spent on iteration: 40.4s (Total time: 13181.9s)
Iteration 48 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -164.4388002268635 L_W_new: -167.98950309078364 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 3.125418428768955e-05 sigma_epsilon: 1.8866116371982664
ESS = 792.69
Time spent on iteration: 40.4s (Total time: 13222.4s)
Iteration 49 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -167.98950309078364 L_W_new: -171.54020595470377 exp(L_W_new-L_W_old): 0.028704457234985978 weight: 3.109083918827095e-05 sigma_epsilon: 1.8866116371982664
ESS = 757.31
Time spent on iteration: 40.2s (Total time: 13262.5s)
Iteration 50 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -171.54020595470377 L_W_new: -175.09090881862392 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 3.0819624739989454e-05 sigma_epsilon: 1.8866116371982664
ESS = 722.27
Time spent on iteration: 39.7s (Total time: 13302.3s)
Iteration 51 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -175.09090881862392 L_W_new: -178.64161168254407 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 3.04501530178646e-05 sigma_epsilon: 1.8866116371982664
ESS = 687.78
Time spent on iteration: 40.1s (Total time: 13342.3s)
Iteration 52 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -178.64161168254407 L_W_new: -182.19231454646422 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.999207320320933e-05 sigma_epsilon: 1.8866116371982664
ESS = 653.95
Time spent on iteration: 40.1s (Total time: 13382.4s)
Iteration 53 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -182.19231454646422 L_W_new: -185.74301741038437 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.9454897434650207e-05 sigma_epsilon: 1.8866116371982664
ESS = 620.87
Time spent on iteration: 40.1s (Total time: 13422.5s)
Iteration 54 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -185.74301741038437 L_W_new: -189.29372027430452 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.8847869384548307e-05 sigma_epsilon: 1.8866116371982664
ESS = 588.59
Time spent on iteration: 40.9s (Total time: 13463.4s)
Iteration 55 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -189.29372027430452 L_W_new: -192.84442313822467 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.8179869144879662e-05 sigma_epsilon: 1.8866116371982664
ESS = 557.15
Time spent on iteration: 40.4s (Total time: 13503.7s)
Iteration 56 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -192.84442313822467 L_W_new: -196.39512600214482 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.745934802342932e-05 sigma_epsilon: 1.8866116371982664
ESS = 526.58
Time spent on iteration: 39.0s (Total time: 13542.7s)
Iteration 57 out of 101:
Scaling_factor: 1 Logprior: -1.106468486536644 Loglik: -355.07028639201485 L_W_old: -196.39512600214482 L_W_new: -199.94582886606497 exp(L_W_new-L_W_old): 0.028704457234985162 weight: 2.6694287290936645e-05 sigma_epsilon: 1.8866116371982664
ESS = 496.92
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1759.7s (Total time: 15302.5s)
Iteration 58 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -203.85104419682764 L_W_new: -207.4764602717307 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 2.6638011622168348e-05 sigma_epsilon: 1.5491078124072604
ESS = 997.60
Time spent on iteration: 39.2s (Total time: 15341.6s)
Iteration 59 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -207.4764602717307 L_W_new: -211.1018763466337 exp(L_W_new-L_W_old): 0.026638011622169864 weight: 2.3874585160642064e-05 sigma_epsilon: 1.5491078124072604
ESS = 990.86
Time spent on iteration: 38.4s (Total time: 15380.1s)
Iteration 60 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -211.1018763466337 L_W_new: -214.72729242153673 exp(L_W_new-L_W_old): 0.026638011622169104 weight: 2.134644910806234e-05 sigma_epsilon: 1.5491078124072604
ESS = 980.37
Time spent on iteration: 38.8s (Total time: 15418.9s)
Iteration 61 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -214.72729242153673 L_W_new: -218.3527084964398 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 1.9042316374500398e-05 sigma_epsilon: 1.5491078124072604
ESS = 966.62
Time spent on iteration: 38.5s (Total time: 15457.4s)
Iteration 62 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -218.3527084964398 L_W_new: -221.97812457134282 exp(L_W_new-L_W_old): 0.026638011622169104 weight: 1.6949649261254294e-05 sigma_epsilon: 1.5491078124072604
ESS = 950.01
Time spent on iteration: 38.6s (Total time: 15496.1s)
Iteration 63 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -221.97812457134282 L_W_new: -225.60354064624588 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 1.5055172082011947e-05 sigma_epsilon: 1.5491078124072604
ESS = 930.90
Time spent on iteration: 39.4s (Total time: 15535.4s)
Iteration 64 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -225.60354064624588 L_W_new: -229.22895672114893 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 1.3345277191172793e-05 sigma_epsilon: 1.5491078124072604
ESS = 909.61
Time spent on iteration: 38.5s (Total time: 15574.0s)
Iteration 65 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -229.22895672114893 L_W_new: -232.85437279605196 exp(L_W_new-L_W_old): 0.026638011622169104 weight: 1.1806341253096604e-05 sigma_epsilon: 1.5491078124072604
ESS = 886.44
Time spent on iteration: 38.5s (Total time: 15612.5s)
Iteration 66 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -232.85437279605196 L_W_new: -236.47978887095502 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 1.0424966879386422e-05 sigma_epsilon: 1.5491078124072604
ESS = 861.67
Time spent on iteration: 38.6s (Total time: 15651.1s)
Iteration 67 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -236.47978887095502 L_W_new: -240.10520494585805 exp(L_W_new-L_W_old): 0.026638011622169104 weight: 9.188162885563276e-06 sigma_epsilon: 1.5491078124072604
ESS = 835.59
Time spent on iteration: 38.8s (Total time: 15689.9s)
Iteration 68 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -240.10520494585805 L_W_new: -243.7306210207611 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 8.083474560793127e-06 sigma_epsilon: 1.5491078124072604
ESS = 808.46
Time spent on iteration: 38.2s (Total time: 15728.1s)
Iteration 69 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -243.7306210207611 L_W_new: -247.35603709566413 exp(L_W_new-L_W_old): 0.026638011622169104 weight: 7.099073609867166e-06 sigma_epsilon: 1.5491078124072604
ESS = 780.56
Time spent on iteration: 39.0s (Total time: 15767.0s)
Iteration 70 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -247.35603709566413 L_W_new: -250.9814531705672 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 6.223815866876625e-06 sigma_epsilon: 1.5491078124072604
ESS = 752.12
Time spent on iteration: 38.4s (Total time: 15805.4s)
Iteration 71 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -250.9814531705672 L_W_new: -254.60686924547022 exp(L_W_new-L_W_old): 0.026638011622169104 weight: 5.447273512919875e-06 sigma_epsilon: 1.5491078124072604
ESS = 723.41
Time spent on iteration: 39.4s (Total time: 15844.8s)
Iteration 72 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -254.60686924547022 L_W_new: -258.2322853203732 exp(L_W_new-L_W_old): 0.02663801162217062 weight: 4.759747353555251e-06 sigma_epsilon: 1.5491078124072604
ESS = 694.63
Time spent on iteration: 38.4s (Total time: 15883.2s)
Iteration 73 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -258.2322853203732 L_W_new: -261.85770139527625 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 4.1522637125369584e-06 sigma_epsilon: 1.5491078124072604
ESS = 665.99
Time spent on iteration: 46.6s (Total time: 15929.8s)
Iteration 74 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -261.85770139527625 L_W_new: -265.4831174701793 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 3.616559658286668e-06 sigma_epsilon: 1.5491078124072604
ESS = 637.70
Time spent on iteration: 42.1s (Total time: 15971.9s)
Iteration 75 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -265.4831174701793 L_W_new: -269.1085335450823 exp(L_W_new-L_W_old): 0.026638011622169864 weight: 3.14505957854897e-06 sigma_epsilon: 1.5491078124072604
ESS = 609.90
Time spent on iteration: 40.8s (Total time: 16012.7s)
Iteration 76 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -269.1085335450823 L_W_new: -272.73394961998537 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 2.7308455371267162e-06 sigma_epsilon: 1.5491078124072604
ESS = 582.74
Time spent on iteration: 40.0s (Total time: 16052.7s)
Iteration 77 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -272.73394961998537 L_W_new: -276.3593656948884 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 2.3676233662381703e-06 sigma_epsilon: 1.5491078124072604
ESS = 556.33
Time spent on iteration: 40.3s (Total time: 16093.0s)
Iteration 78 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -276.3593656948884 L_W_new: -279.9847817697915 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 2.0496860526721616e-06 sigma_epsilon: 1.5491078124072604
ESS = 530.79
Time spent on iteration: 40.7s (Total time: 16133.7s)
Iteration 79 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -279.9847817697915 L_W_new: -283.61019784469454 exp(L_W_new-L_W_old): 0.026638011622168348 weight: 1.771875651400008e-06 sigma_epsilon: 1.5491078124072604
ESS = 506.16
Time spent on iteration: 40.4s (Total time: 16174.1s)
Iteration 80 out of 101:
Scaling_factor: 1 Logprior: -0.8277440022573203 Loglik: -362.5416074903041 L_W_old: -283.61019784469454 L_W_new: -287.23561391959754 exp(L_W_new-L_W_old): 0.026638011622169864 weight: 1.5295446945316267e-06 sigma_epsilon: 1.5491078124072604
ESS = 482.53
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1839.0s (Total time: 18013.1s)
Iteration 81 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -272.6288829106759 L_W_new: -276.06966438709594 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 3.2039637320848686e-05 sigma_epsilon: 1.5256432227937586
ESS = 998.72
Time spent on iteration: 41.3s (Total time: 18054.4s)
Iteration 82 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -276.06966438709594 L_W_new: -279.51044586351594 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 3.3164807739430554e-05 sigma_epsilon: 1.5256432227937586
ESS = 995.00
Time spent on iteration: 40.2s (Total time: 18094.6s)
Iteration 83 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -279.51044586351594 L_W_new: -282.951227339936 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 3.428560796394583e-05 sigma_epsilon: 1.5256432227937586
ESS = 989.04
Time spent on iteration: 40.2s (Total time: 18134.8s)
Iteration 84 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -282.951227339936 L_W_new: -286.392008816356 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 3.53999352967456e-05 sigma_epsilon: 1.5256432227937586
ESS = 981.04
Time spent on iteration: 40.3s (Total time: 18175.1s)
Iteration 85 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -286.392008816356 L_W_new: -289.832790292776 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 3.6505749676975165e-05 sigma_epsilon: 1.5256432227937586
ESS = 971.22
Time spent on iteration: 40.3s (Total time: 18215.3s)
Iteration 86 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -289.832790292776 L_W_new: -293.27357176919605 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 3.760108388398123e-05 sigma_epsilon: 1.5256432227937586
ESS = 959.80
Time spent on iteration: 40.1s (Total time: 18255.5s)
Iteration 87 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -293.27357176919605 L_W_new: -296.71435324561605 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 3.868405260807813e-05 sigma_epsilon: 1.5256432227937586
ESS = 946.99
Time spent on iteration: 40.3s (Total time: 18295.7s)
Iteration 88 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -296.71435324561605 L_W_new: -300.1551347220361 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 3.975286033970507e-05 sigma_epsilon: 1.5256432227937586
ESS = 933.02
Time spent on iteration: 40.3s (Total time: 18336.0s)
Iteration 89 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -300.1551347220361 L_W_new: -303.5959161984561 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 4.0805808050884905e-05 sigma_epsilon: 1.5256432227937586
ESS = 918.09
Time spent on iteration: 40.2s (Total time: 18376.2s)
Iteration 90 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -303.5959161984561 L_W_new: -307.0366976748761 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 4.184129866427318e-05 sigma_epsilon: 1.5256432227937586
ESS = 902.38
Time spent on iteration: 40.3s (Total time: 18416.5s)
Iteration 91 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -307.0366976748761 L_W_new: -310.47747915129617 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 4.285784132514903e-05 sigma_epsilon: 1.5256432227937586
ESS = 886.07
Time spent on iteration: 40.3s (Total time: 18456.8s)
Iteration 92 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -310.47747915129617 L_W_new: -313.91826062771617 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 4.385405450951391e-05 sigma_epsilon: 1.5256432227937586
ESS = 869.32
Time spent on iteration: 40.5s (Total time: 18497.2s)
Iteration 93 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -313.91826062771617 L_W_new: -317.3590421041362 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 4.48286680171023e-05 sigma_epsilon: 1.5256432227937586
ESS = 852.28
Time spent on iteration: 40.1s (Total time: 18537.3s)
Iteration 94 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -317.3590421041362 L_W_new: -320.7998235805562 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 4.57805239114057e-05 sigma_epsilon: 1.5256432227937586
ESS = 835.07
Time spent on iteration: 40.0s (Total time: 18577.3s)
Iteration 95 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -320.7998235805562 L_W_new: -324.2406050569763 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 4.6708576479382e-05 sigma_epsilon: 1.5256432227937586
ESS = 817.82
Time spent on iteration: 40.4s (Total time: 18617.7s)
Iteration 96 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -324.2406050569763 L_W_new: -327.6813865333963 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 4.76118912918993e-05 sigma_epsilon: 1.5256432227937586
ESS = 800.60
Time spent on iteration: 40.1s (Total time: 18657.8s)
Iteration 97 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -327.6813865333963 L_W_new: -331.1221680098163 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 4.848964345160918e-05 sigma_epsilon: 1.5256432227937586
ESS = 783.51
Time spent on iteration: 40.3s (Total time: 18698.1s)
Iteration 98 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -331.1221680098163 L_W_new: -334.56294948623633 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 4.9341115118627176e-05 sigma_epsilon: 1.5256432227937586
ESS = 766.62
Time spent on iteration: 40.2s (Total time: 18738.3s)
Iteration 99 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -334.56294948623633 L_W_new: -338.00373096265633 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 5.016569240578166e-05 sigma_epsilon: 1.5256432227937586
ESS = 749.98
Time spent on iteration: 40.4s (Total time: 18778.8s)
Iteration 100 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -338.00373096265633 L_W_new: -341.4445124390764 exp(L_W_new-L_W_old): 0.032039637320848684 weight: 5.096286173474691e-05 sigma_epsilon: 1.5256432227937586
ESS = 733.63
Time spent on iteration: 39.8s (Total time: 18818.6s)
Iteration 101 out of 101:
Scaling_factor: 1 Logprior: -0.8071462734940132 Loglik: -344.07814764200236 L_W_old: -341.4445124390764 L_W_new: -344.8852939154964 exp(L_W_new-L_W_old): 0.0320396373208505 weight: 5.1732205742525724e-05 sigma_epsilon: 1.5256432227937586
ESS = 717.63
Final Resampling
Started Resampling
Doing MCMC
Resampled
Time spent on iteration: 1851.7s (Total time: 20670.2s)
Note: for the sms_sampler_pro function, we need a very small number of N_MCMC_updates, as there are N_params times more MCMC steps than in the en-bloc updating sampler. So, for instance, 3 MCMC steps when there are 10 parameters are equivalent to 30 MCMC steps in the older version.
plot_features = {'ESS':{'n_frequency': 10, 'alpha': 0.5},
'metaplot': {'histogram': False, 'kde': True, 'layout': (5,2), 'figsize': (12,20)},
'SDF':{'with_peaks': True, 'with_periodogram': True, 'log_scale': True,'align_scale': False,'periodogram_display': 'line','high_res': True},
'variance':{'multiply': False, 'divide': False, 'times_variance': False}}
post_process_smc(particles_init,particles_SMC_cpi_garma_10112_tapered,diagnostics_SMC_cpi_garma_10112_tapered,data,model_spec,
plot_init = True, param_true = None, S_true = None, stat = 'mode',
ESS = True, histogram = True, scatter = False, boxplot = True, table = True,
SDF = True, BIC = True, L2 = True, plot_settings = plot_features,
save = False, display = True, plot_titles=False)
# S_garma_11012, param_true_garma_11012, particles_init
Maximized Loglikelihood: -343.6454522955665 BIC: 749.4607021019722
| Parameter | Minimum | Maximum | Mean | Median | Mode | |
|---|---|---|---|---|---|---|
| 1 | $\alpha_{11}^R$ (AR Real 1) | 0.002 | 0.64 | 0.238 | 0.245 | 0.245 |
| 2 | $\alpha_{21}^R$ (MA Real 1) | 0.011 | 0.447 | 0.171 | 0.159 | 0.159 |
| 3 | $\alpha_{21}^C$ (MA Complex Modulus 1) | 0.001 | 0.354 | 0.098 | 0.085 | 0.053 |
| 4 | $\omega_{21}^C$ (MA Complex Argument 1) | 0 | 0.386 | 0.065 | 0.057 | 0.021 |
| 5 | $\lambda_1$ (Gegenbauer 1) | 0.851 | 0.874 | 0.865 | 0.864 | 0.864 |
| 6 | $\lambda_2$ (Gegenbauer 2) | 0.337 | 0.531 | 0.495 | 0.497 | 0.497 |
| 7 | $\delta_1$ (Gegenbauer memory 1) | 0.049 | 0.364 | 0.216 | 0.214 | 0.207 |
| 8 | $\delta_2$ (Gegenbauer memory 2) | 0.107 | 0.374 | 0.228 | 0.225 | 0.207 |
| 9 | $\sigma_\epsilon^2$ (Innovation Variance) | 1.297 | 1.927 | 1.544 | 1.546 | 1.413 |
garma_11012_model_path = '/Users/mateipapahagi/Desktop/M4R/M4R Code/GARMA_11012/'
particles_init_garma_11012 = pd.read_csv(garma_11012_model_path + 'GARMA_11012_particles_init_06.05.2022_22h50m.txt',header=None)
particles_SMC_garma_11012 = pd.read_csv(garma_11012_model_path + 'GARMA_11012_particles_SMC_06.05.2022_22h50m.txt',header=None)
with open(garma_11012_model_path + 'GARMA_11012_diagnostics_SMC_06.05.2022_22h50m.json') as json_file:
diagnostics_SMC_garma_11012 = json.load(json_file)
f_garma_11012, Z_garma_11012 = S_p_vec(x_garma_11012,tapered=True,taper='boxcar')
data_garma_11012 = (f_garma_11012,Z_garma_11012)
model_spec_garma_11012 = (1,1,0,1,2)
post_process_smc(particles_init_garma_11012,particles_SMC_garma_11012,diagnostics_SMC_garma_11012,data_garma_11012,model_spec_garma_11012,
plot_init = True, param_true = param_true_garma_11012, S_true = S_garma_11012, stat = 'mean',
ESS = False, histogram = False, scatter = False, boxplot = True, table = False,
SDF = False, BIC = False, L2 = False, plot_settings = plot_features,
save = False, display = True, plot_titles=False)
Notes:
# Function to build AR and MA polynomials from reciprocal roots
def ARMA_polynomial(xi,polynomial=True,table=True,process='AR',save=False,print=True):
'''
xi (list) - vector of reciprocal roots (complex)
display (bool) - display polynomial
table (bool) - return table of coefficients
process (str) - 'AR' or 'MA'
'''
# convert list of reciprocal roots to numpy array
xi = np.array(xi)
# calculate the polynomial roots (1/xi)
roots = np.divide(1,xi)
# multiplication factor in front of resulting polynomial
multiplier = np.prod(-xi) # alternatively, multiplier = 1/arma_poly_unscaled[-1]
# resulting polynomial
arma_poly_unscaled = np.poly(roots)
# adjust for conjugate roots
arma_poly = multiplier * arma_poly_unscaled
n = len(arma_poly) # degree of polynomial #n = arma_poly.shape[0]
#arma_poly[0] = 1
# resulting coefficients must be real
assert (sum(abs(coef.imag) for coef in arma_poly) < 1e-6), 'Not all coefficients are real'
# convert to real
arma_poly = np.round(arma_poly.real,3)
# options to coefficients and the polynomial
if table == True:
# make latex coefficient names
if process == 'AR':
coef_names = [r'$\phi_{}$'.format(i) for i in range(0,n)]
if process == 'MA':
coef_names = [r'$\theta_{}$'.format(i) for i in range(0,n)]
# make dataframe
coef_df = pd.DataFrame({process+' Coefficient':coef_names,
'Value':np.flip(arma_poly)})
coef_df.index = pd.RangeIndex(start=1, stop=len(coef_names)+1, step=1)
if print == True: display(Markdown(coef_df.round(3).to_markdown()))
if save == True:
coef_df = coef_df.style.format(decimal='.', thousands=',', precision=3)
with open(process+'_coef'+'.tex', 'w') as tf:
tf.write(coef_df.to_latex())
if polynomial == True:
# make latex polynomial expression
if process == 'AR':
monomials_expr = [r'$\Phi(z)=1']+[r'-\phi_{}z^{}'.format(i,i) for i in range(1,n)]+['$']
if process == 'MA':
monomials_expr = [r'$\Theta(z)=1']+[r'-\theta_{}z^{}'.format(i,i) for i in range(1,n)]+['$']
poly_expr = ''.join(monomials_expr)
# make latex evaluated polynomial
coef_signs = ['-' if x<0 else '+' for x in arma_poly]
if process == 'AR':
monomials_eval = [r'$\Phi(z)=1']+[coef_signs[n-i-1]+str(abs(arma_poly[n-i-1]))+r'z^{}'.format(i) for i in range(1,n)]+['$']
if process == 'MA':
monomials_eval = [r'$\Theta(z)=1']+[coef_signs[n-i-1]+str(abs(arma_poly[n-i-1]))+r'z^{}'.format(i) for i in range(1,n)]+['$']
poly_eval = ''.join(monomials_eval)
# make dataframe
poly_df = pd.DataFrame({process+' Polynomial':[poly_expr,poly_eval]})
poly_df.index = ['Expression','Value']
if print == True: display(Markdown(poly_df.to_markdown()))
if save == True:
poly_df = poly_df.style.format(decimal='.', thousands=',', precision=3)
with open(process+'_polynomial'+'.tex', 'w') as tf:
tf.write(poly_df.to_latex())
return(arma_poly)
def ARMA_sim(N,Rp,Cp,Rq,Cq,
alpha1R=None,alpha1C=None,omega1C=None,
alpha2R=None,alpha2C=None,omega2C=None,
polynomial=False,table=False,
save=False,print=True):
# direct ARMA simulation using statsmodels.api
if alpha1R == None: alpha1R = list(np.random.uniform(0,1,Rp))
if alpha1C == None: alpha1C = list(np.random.uniform(0,1,Cp))
alpha1 = alpha1R + alpha1C
omega1R = [0] * Rp
if omega1C == None: omega1C = list(np.random.uniform(0,1/2,Cp))
omega1 = omega1R + omega1C
if alpha2R == None: alpha2R = list(np.random.uniform(0,1,Rq))
if alpha2C == None: alpha2C = list(np.random.uniform(0,1,Cq))
alpha2 = alpha2R + alpha2C
omega2R= [0] * Rq
if omega2C == None: omega2C = list(np.random.uniform(0,1/2,Cq))
omega2 = omega2R + omega2C
AR_xi = xi_builder(alpha1,omega1)
MA_xi = xi_builder(alpha2,omega2)
if len(AR_xi) > 0:
AR_poly = ARMA_polynomial(AR_xi,polynomial,table,process='AR',save=save,print=print)
AR_coefs = np.flip(AR_poly)
else: AR_coefs = np.array([0]) #np.array([])
if len(MA_xi) > 0:
MA_poly = ARMA_polynomial(MA_xi,polynomial,table,process='MA',save=save,print=print)
MA_coefs = np.flip(MA_poly)
else: MA_coefs = np.array([0]) #np.array([])
#np.random.seed(123)
# generate ARMA process of length N
ARMA_ts = sm.tsa.arma_generate_sample(AR_coefs, MA_coefs, N)
return ARMA_ts
This is the approximate frequency-domain method in Percival (1992).
import matplotlib.image as mpimg
image4 = mpimg.imread("Approximate_Freq_Domai_Method.png")
plt.imshow(image4)
plt.axis('off')
plt.show()
Consider the simulated ARMA(3,0,3) data from before. We compute the true spectrum for this data and use it to determine its autocovariance sequence, which we then use to simulate the process using a finite truncation of the white noise process. The methodology is that from Percival (1992).
# function to simulate a realisation of the process
def approx_fd_sim(S):
'''
S - the sdf (length M//2)
W - the white noise process (length M)
'''
# M is any even integer >= desired sample size N
# since we only have N/2+1 values for S (spectrum)
# we must take M=N
# generate a standard Gaussian white noise
#if len(S)%2==0: M = 2*len(S)
M = 2*(len(S)-1)
W_mean = 0; W_std = 1 # or sqrt(sigma_epsilon_sim)
W = rng.normal(loc=W_mean, scale=W_std, size=M)
# double range of Fourier frequencies
f = np.array([j/M for j in range(0,M)]) #j=0,...,M-1
# make sure that the first half of f (ranging from 0 to 1/2)
# is perfectly aligned with S
assert f[M//2] == 1/2
assert S[M//2] == S[-1]
# form U
U = np.zeros(M,dtype=np.complex_)
U[0] = np.sqrt(S[0])*W[0]
# 1<=j<M/2
for j in range (1,M//2):
U[j] = np.sqrt(1/2*S[j])*(W[2*j-1]+1j*W[2*j])
# j=M/2
U[M//2] = np.sqrt(S[M//2])*(W[M-1])
# M/2 < j <= M-1
for j in range (M//2+1,M):
U[j] = np.conj(U[M-j])
# form V
V = np.zeros(M,dtype=np.float64)
for t in range(0,M):
V[t] = 1/np.sqrt(M)*sum([(U[j]*cmath.exp(-1j*2*pi*f[j]*t)).real for j in range(0,M)])
return V
def spectrum_sim(Rp,Cp,Rq,Cq,k,N,
alpha1R=None,alpha1C=None,omega1C=None,
alpha2R=None,alpha2C=None,omega2C=None,
Lambda=None,delta=None,sigma_epsilon=None):
p = Rp + 2*Cp
q = Rq + 2*Cq
# default parameters
if alpha1R == None: alpha1R = list(np.random.uniform(0,1,Rp))
if alpha1C == None: alpha1C = list(np.random.uniform(0,1,Cp))
alpha1 = alpha1R + alpha1C
omega1R = [0] * Rp
if omega1C == None: omega1C = list(np.random.uniform(0,1/2,Cp))
omega1 = omega1R + omega1C
if alpha2R == None: alpha2R = list(np.random.uniform(0,1,Rq))
if alpha2C == None: alpha2C = list(np.random.uniform(0,1,Cq))
alpha2 = alpha2R + alpha2C
omega2R = [0] * Rq
if omega2C == None: omega2C = list(np.random.uniform(0,1/2,Cq))
omega2 = omega2R + omega2C
if Lambda == None: Lambda = list(np.random.uniform(-1,1,k))
if delta == None: delta = list(np.random.uniform(0,1/2,k))
if sigma_epsilon == None: sigma_epsilon = 1
# Fourier grid
f = [j/N for j in range(0,N//2+1)]
# calculate the spectrum
S = S_Y_vec(f,alpha1,omega1,alpha2,omega2,
Lambda,delta,sigma_epsilon,
p,q,k)
# return the simulation
return approx_fd_sim(S)
To be implemented...
# apply these succesively to Gaussian white noise
def AR_filter(*args):
pass
def MA_filter(*args):
pass
def G_filter(*args):
pass
To be implemented...
# Future Development
# function to save model specification
def save_model(model_spec,alpha1R,alpha1C,omega1C,
alpha2R,alpha2C,omega2C,
Lambda,delta,sigma_epsilon,
file_name = 'coef.csv'):
Rp,Cp,Rq,Cq,k = model_spec
# joined parameter list
param_true = alpha1R+alpha1C+omega1C+alpha2R+alpha2C+omega2C+Lambda+delta+[sigma_epsilon]
model_dict = {
'Rp':Rp,'Cp':Cp,'Rq':Rq,'Cq':Cq,'k':k,
'alpha1R': alpha1R,'alpha1C': alpha1C, 'omega1C': omega1C,
'alpha2R': alpha2R,'alpha2C': alpha2C,'omega2C': omega2C,
'lambda': Lambda,'delta': delta, 'sigma_epsilon': sigma_epsilon,
'param_true': param_true
}
with open(file_name,'w') as f:
w = csv.writer(f)
w.writerows(model_dict.items())
x_arma_1111 = ARMA_sim(Rp=1,Cp=1,
Rq=1,Cq=1,N=500,
alpha1R=[0.3],
alpha1C=[0.9],
omega1C=[0.3],
alpha2R=[0.4],
alpha2C=[0.8],
omega2C=[0.2],
polynomial=True,table=True,
save=True,print=True)
# standardise the TS
# x_arma_1111 = pre_process_ts(x_arma_1111,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_arma_1111,n_lags=400,title="ARMA(3,3) process with real and complex roots")
# save the time series and the model specification
# np.savetxt('ARMA_1111_1000.csv', x_arma_1111, delimiter=",")
# save_model((1,1,1,1,0),alpha1R=[0.3],
# alpha1C=[0.9],
# omega1C=[0.3],
# alpha2R=[0.4],
# alpha2C=[0.8],
# omega2C=[0.2],
# Lambda=[],
# delta=[],
# sigma_epsilon=1,
# file_name='x_arma_1111_coef')
| AR Coefficient | Value | |
|---|---|---|
| 1 | $\phi_0$ | 1 |
| 2 | $\phi_1$ | 0.256 |
| 3 | $\phi_2$ | 0.643 |
| 4 | $\phi_3$ | -0.243 |
| AR Polynomial | |
|---|---|
| Expression | $\Phi(z)=1-\phi_1z^1-\phi_2z^2-\phi_3z^3$ |
| Value | $\Phi(z)=1+0.256z^1+0.643z^2-0.243z^3$ |
| MA Coefficient | Value | |
|---|---|---|
| 1 | $\theta_0$ | 1 |
| 2 | $\theta_1$ | -0.894 |
| 3 | $\theta_2$ | 0.838 |
| 4 | $\theta_3$ | -0.256 |
| MA Polynomial | |
|---|---|
| Expression | $\Theta(z)=1-\theta_1z^1-\theta_2z^2-\theta_3z^3$ |
| Value | $\Theta(z)=1-0.894z^1+0.838z^2-0.256z^3$ |
# alternatively:
x_arma_1111_bis = spectrum_sim(Rp=1,Cp=1,
Rq=1,Cq=1,
k=0,N=500,
alpha1R=[0.3],
alpha1C=[0.9],
omega1C=[0.3],
alpha2R=[0.4],
alpha2C=[0.8],
omega2C=[0.2],
Lambda=[],
delta=[],
sigma_epsilon=1)
# standardise the TS
# x_arma_1111_bis = pre_process_ts(x_arma_1111_bis,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_arma_1111_bis,n_lags=400,title="ARMA(3,3) Process")
# Calculate Spectrum, Periodogram, and ACVS for the simulated data
# periodogram
f_arma_1111, Z_arma_1111 = S_p_vec(x_arma_1111)
# spectrum
S_arma_1111 = S_Y_vec(f_arma_1111,
alpha1=[0.3,0.9],
omega1=[0,0.3],
alpha2=[0.4,0.8],
omega2=[0,0.2],
Lambda=[],
delta=[],
sigma_epsilon=1,
p=3,q=3,k=0)
#np.savetxt('ARMA_1111_sdf.csv', S_arma_1111 , delimiter=",")
# acvs estimated from spectrum via Inverse DFT (FFT algorithm)
acvs_arma_1111 = np.fft.irfft(S_arma_1111)
# plot periodogram against spectrum
plot_SDF(f_arma_1111,S_arma_1111,with_peaks=True,Lambda=[],alpha1C=[0.9],omega1C=[0.3],log=False,box=False,title='Spectrum of Simulated Data',periodogram_vals=Z_arma_1111)
plt.show()
x_arfima_04 = pd.read_csv("~/Desktop/M4R/M4R Data/Simulated Data/ARFIMA_04_700.csv")
x_arfima_04 =np.array(x_arfima_04['x'])
# standardise the TS
x_arfima_04 = pre_process_ts(x_arfima_04,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_arfima_04,n_lags=400,title="ARFIMA(0,0.4,0) process")
x_gegenbauer_1 = spectrum_sim(Rp=0,Cp=0,
Rq=0,Cq=0,
k=1,N=500,#=672,#700
alpha1R=[],
alpha1C=[],
omega1C=[],
alpha2R=[],
alpha2C=[],
omega2C=[],
Lambda=[0.9],#[0.889]
delta=[0.4],#[0.428]
sigma_epsilon=None)
# standardise the TS
#x_gegenbauer_1 = pre_process_ts(x_gegenbauer_1,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_gegenbauer_1,n_lags=400,title="Gegenbauer Process with $\lambda=0.9$, $\delta=0.4$")
# save the time series
# np.savetxt('Gegenbauer_1_1000.csv', x_gegenbauer_1 , delimiter=",")
# save_model((0,0,0,0,1),alpha1R=[],
# alpha1C=[],
# omega1C=[],
# alpha2R=[],
# alpha2C=[],
# omega2C=[],
# Lambda=[0.9],
# delta=[0.4],
# sigma_epsilon=1,
# file_name='x_gegenbauer_1_coef')
# Calculate Spectrum, Periodogram, and ACVS for the simulated data
# periodogram
f_gegenbauer_1, Z_gegenbauer_1 = signal.periodogram(x_gegenbauer_1,window='boxcar',scaling='density')
# spectrum
S_gegenbauer_1 = S_Y_vec(f_gegenbauer_1,
alpha1=[],
omega1=[],
alpha2=[],
omega2=[],
Lambda=[0.9],
delta=[0.4],
sigma_epsilon=1,
p=0,q=0,k=1)
#np.savetxt('Gegenbauer_1_sdf.csv', S_gegenbauer_1 , delimiter=",")
# acvs estimated from spectrum via Inverse DFT (FFT algorithm)
acvs_gegenbauer_1 = np.fft.irfft(S_gegenbauer_1)
# plot periodogram against spectrum
plot_SDF(f_gegenbauer_1,S_gegenbauer_1,with_peaks=True,Lambda=[0.9],alpha1C=[],omega1C=[],log=False,box=False,title='Spectrum of Simulated Data',periodogram_vals=Z_gegenbauer_1)
plt.show()
x_garma_12111 = spectrum_sim(Rp=1,Cp=2,
Rq=1,Cq=1,
k=1,N=500,
alpha1R=[0.2],
alpha1C=[0.9,0.85],
omega1C=[0.1,0.4],
alpha2R=[0.3],
alpha2C=[0.1],
omega2C=[0.25],
Lambda=[0.3],
delta=[0.35],
sigma_epsilon=None)
# standardise the TS
#x_garma_11111 = pre_process_ts(x_garma_12112,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_garma_12111,n_lags=400,title="GARMA(5,2,3) Process")
# save the time series
# np.savetxt('garma_12111_500.csv', x_garma_12111 , delimiter=",")
# save_model((1,2,1,1,1),alpha1R=[0.2],
# alpha1C=[0.9,0.85],
# omega1C=[0.1,0.4],
# alpha2R=[0.3],
# alpha2C=[0.1],
# omega2C=[0.25],
# Lambda=[0.3],
# delta=[0.35],
# sigma_epsilon=1,
# file_name='x_garma_12111_coef')
# Calculate Spectrum, Periodogram, and ACVS for the simulated data
# periodogram
f_garma_12111, Z_garma_12111 = signal.periodogram(x_garma_12111,window='boxcar',scaling='density')
# spectrum
S_garma_12111 = S_Y_vec(f_garma_12111,
alpha1=[0.2,0.9,0.85],
omega1=[0,0.1,0.4],
alpha2=[0.3,0.1],
omega2=[0,0.25],
Lambda=[0.3],
delta=[0.35],
sigma_epsilon=1,
p=5,q=3,k=1)
#np.savetxt('GARMA_12111_sdf.csv', S_garma_12111 , delimiter=",")
# acvs estimated from spectrum via Inverse DFT (FFT algorithm)
acvs_garma_12111 = np.fft.irfft(S_garma_12111)
# plot periodogram against spectrum
plot_SDF(f_garma_12111,S_garma_12111,with_peaks=True,Lambda=[0.3],alpha1C=[0.9,0.85],omega1C=[0.1,0.4],log=False,box=False,title='Spectrum of Simulated Data',periodogram_vals=Z_garma_12111)
plt.show()
x_garma_11012 = spectrum_sim(Rp=1,Cp=1,
Rq=0,Cq=1,
k=2,N=500,
alpha1R=[0.2],
alpha1C=[0.9],
omega1C=[0.1],
alpha2R=[],
alpha2C=[0.2],
omega2C=[0.1],
Lambda=[-0.3,-0.9],
delta=[0.4,0.45],
sigma_epsilon=None)
# standardise the TS
#x_garma_11111 = pre_process_ts(x_garma_12112,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_garma_11012,n_lags=400,title="GARMA(3,2,2) Process")
# save the time series
# np.savetxt('garma_11012_500.csv', x_garma_11012 , delimiter=",")
# save_model((1,1,0,1,2),alpha1R=[0.2],
# alpha1C=[0.9],
# omega1C=[0.1],
# alpha2R=[],
# alpha2C=[0.2],
# omega2C=[0.1],
# Lambda=[-0.3,-0.9],
# delta=[0.4,0.45],
# sigma_epsilon=1,
# file_name='x_garma_11012_coef')
# Calculate Spectrum, Periodogram, and ACVS for the simulated data
# periodogram
f_garma_11012, Z_garma_11012 = signal.periodogram(x_garma_11012,window='boxcar',scaling='density')
# spectrum
S_garma_11012 = S_Y_vec(f_garma_11012,
alpha1=[0.2,0.9],
omega1=[0,0.1],
alpha2=[0.2],
omega2=[0.1],
Lambda=[-0.3,-0.9],
delta=[0.45,0.4],
sigma_epsilon=1,
p=3,q=2,k=2)
#np.savetxt('GARMA_11012_sdf.csv', S_garma_11012 , delimiter=",")
# acvs estimated from spectrum via Inverse DFT (FFT algorithm)
acvs_garma_11012 = np.fft.irfft(S_garma_11012)
# plot periodogram against spectrum
plot_SDF(f_garma_11012,S_garma_11012,with_peaks=True,Lambda=[-0.3,-0.9],alpha1C=[0.85],omega1C=[0.1],log=False,box=False,title='Spectrum of Simulated Data',periodogram_vals=Z_garma_11012)
plt.show()
figure_output_path = '/Users/mateipapahagi/Desktop/M4R/M4R Article+Figures'
# processes:
x_arma_0110 = spectrum_sim(Rp=0,Cp=1,
Rq=1,Cq=0,
k=0,N=500,
alpha1R=[],
alpha1C=[0.95],
omega1C=[0.2],
alpha2R=[0.5],
alpha2C=[],
omega2C=[],
Lambda=[],
delta=[],
sigma_epsilon=None)
x_garma_00101 = spectrum_sim(Rp=0,Cp=0,
Rq=1,Cq=0,
k=1,N=500,
alpha1R=[],
alpha1C=[],
omega1C=[],
alpha2R=[0.15],
alpha2C=[],
omega2C=[],
Lambda=[0.9],
delta=[0.4],
sigma_epsilon=None)
# plot acf of ARMA vs ARFIMA vs Gegenbauer
fig = plt.figure(figsize=(16, 12))
max_lag = 150
# ARMA(2,2)
ax1 = plt.subplot(3,1,1)
plot_acf(x_arma_0101,lags=max_lag,ax=ax1,bartlett_confint=False,alpha=0.99)
plt.margins(x=0)
plt.xticks(np.arange(0, max_lag+1, 5))
# ARFIMA(0,0.4,0)
ax2 = plt.subplot(3,1,2)
plot_acf(x_arfima_04,lags=max_lag,ax=ax2,bartlett_confint=False,alpha=0.99)
plt.margins(x=0)
plt.xticks(np.arange(0, max_lag+1, 5))
# Gegenbauer
ax3 = plt.subplot(3,1,3)
plot_acf(x_garma_00001,lags=max_lag,ax=ax3,bartlett_confint=False,alpha=0.99)
plt.margins(x=0)
plt.xticks(np.arange(0, max_lag+1, 5))
# titles and other configs
ax1.set_title('ARMA(2,1) Process',fontsize=18)
ax2.set_title('ARFIMA(0,0.4,0) Process',fontsize=18)
ax3.set_title('GARMA(0,1,1) Process',fontsize=18)
#plt.suptitle('Autocorrelation Sequence', fontsize=20)
fig.supxlabel('Lag',fontsize=18)
fig.supylabel('Autocorrelation',fontsize=18)
plt.tight_layout(pad=1.5, h_pad=1.5, w_pad=1.5)
#plt.savefig(figure_output_path + '/ARMA_vs_ARFIMA_vs_Gegenbauer_ACF_new.png')
plt.show()
Same GARMA(3,2,2) process as used in section 6.2.1.
# redefine high-res frequency grid to see the infinite peaks
f_garma_11012_high_res = np.linspace(0,0.5,100000)
S_garma_11012_high_res = S_Y_vec(f_garma_11012_high_res,
alpha1=[0.2,0.9],
omega1=[0,0.1],
alpha2=[0.2],
omega2=[0.1],
Lambda=[-0.3,-0.9],
delta=[0.45,0.4],
sigma_epsilon=1,
p=3,q=2,k=2)
plot_SDF(f_garma_11012_high_res,S_garma_11012_high_res,with_peaks=True,
Lambda=[-0.3,-0.9],alpha1C=[0.9],omega1C=[0.1],title='',log=False,estimated_legend=False)
plt.ylim(0,30)
plt.savefig(figure_output_path + '/AR_vs_Gegenbauer_peaks.png')
plt.show()
x_ar_2 = spectrum_sim(Rp=0,Cp=2,
Rq=0,Cq=0,
k=0,N=500,
alpha1R=[],
alpha1C=[0.9,0.8],
omega1C=[0.3,0.1],
alpha2R=[],
alpha2C=[],
omega2C=[],
Lambda=[],
delta=[],
sigma_epsilon=None)
# standardise the TS
#x_ar_11 = pre_process_ts(x_ar_11,normal=False, standard=True, n_differences=0)
# plot the TS, its periodogram, and its acf
ts_plot3(x_ar_2,n_lags=50,title='')#"AR(4) process with complex roots")
#plt.savefig(figure_output_path + '/AR4_process.png')
f_per, Z_per = S_p_vec(y,tapered=True,taper='boxcar')
f_tapered, Z_tapered = S_p_vec(y,tapered=True,taper='hann')
#S_p_vec(y,tapered=False) #S_p_vec(y,tapered=True,taper='hann')
plt.figure(figsize=(13.2, 5))
ax1 = plt.subplot(1,2,1)
ax1.plot(f_per, Z_per, linewidth=2,color='gray')
ax1.set_title('Periodogram',fontsize=16)
ax1.set_xlabel('Frequency',fontsize=14)
ax2 = plt.subplot(1,2,2)
ax2.plot(f_tapered, Z_tapered, linewidth=2,color='gray')
ax2.set_title('Tapered Periodogram (Hann Taper)',fontsize=16)
ax2.set_xlabel('Frequency',fontsize=14)
plt.tight_layout()
distrib_range = np.arange(0,5,0.01)
distrib_range1 = np.arange(1,4,0.01)
color_vals = ['black','blue','green','orange']
label_vals = [r'Uniform $(a=0,b=5)$',r'Inverse Gamma $(\alpha=1,\beta=1)$',r'Truncated Normal $(\mu=2,\sigma^2=0.8,a=1,b=4)$',r'Truncated Normal $(\mu = 0.5,\sigma^2=1,a=0,b=+\infty)$']
plt.figure(figsize=(16, 8))
# InvGamma(1,1)
plt.plot(distrib_range,[invgamma_pdf(x,1,1) for x in distrib_range],color=color_vals[1])
# Yellow Truncated Normal (range [0,+inf], location 0.5, std 1)
plt.plot(distrib_range,[truncnormal_pdf(x,0,+np.inf,0.5,1) for x in distrib_range],color=color_vals[3])
plt.vlines(x=0, ymin=0, ymax=truncnormal_pdf(0,0,+np.inf,0.5,1), color=color_vals[3])
# Black: Uniform(0,5)
plt.plot(distrib_range,[uniform_pdf(0,5) for x in distrib_range],color=color_vals[0])
plt.vlines(x=0, ymin=0, ymax=1/5, color=color_vals[0])
plt.vlines(x=5, ymin=0, ymax=1/5, color=color_vals[0])
# Green: Truncated Normal (range [1,4], location 2, std 0.8)
plt.plot(distrib_range1,[truncnormal_pdf(x,1,4,2,0.8) for x in distrib_range1],color=color_vals[2])
plt.vlines(x=1, ymin=0, ymax=truncnormal_pdf(1,1,4,2,0.8), color=color_vals[2])
plt.vlines(x=4, ymin=0, ymax=truncnormal_pdf(4,1,4,2,0.8), color=color_vals[2])
col_legends = [mpatches.Patch(color=color_vals[i], label=label_vals[i]) for i in range(4)]
plt.legend(handles = col_legends, prop={'size': 15})
plt.ylim(0,1)
plt.xlabel('Value',size=15)
plt.ylabel('Density',size=15)
fig.tight_layout()
#plt.savefig(figure_output_path + '/distribution_examples_new.png')
/var/folders/4k/p7n1kyzs49l7lybkfc5wdl8m0000gn/T/ipykernel_727/3508162669.py:7: RuntimeWarning: divide by zero encountered in double_scalars return (beta**alpha)/gamma(alpha)*(1/x)**(alpha+1)*exp(-beta/x) /var/folders/4k/p7n1kyzs49l7lybkfc5wdl8m0000gn/T/ipykernel_727/3508162669.py:7: RuntimeWarning: invalid value encountered in double_scalars return (beta**alpha)/gamma(alpha)*(1/x)**(alpha+1)*exp(-beta/x)
def Hanning(f,N):
return np.array([np.abs(sum([np.hanning(N)[t]*cmath.exp(-1j*2*pi*f*t) for t in range(1,N)]))**2 for f in f])
def freq_response(N,window_type='hann'):
if window_type == 'hann':
window = signal.windows.hann(N)
elif window_type == 'boxcar':
window = signal.windows.boxcar(N)
A = fft(window, 2048) / (len(window)/2.0)
freq = np.linspace(-0.5, 0.51, len(A))
response = np.abs(fftshift(A / abs(A).max()))
response = 20 * np.log10(np.maximum(response, 1e-10))
return freq, response
fig, ((ax11, ax21), (ax12,ax22), (ax13, ax23)) = plt.subplots(3, 2, figsize=(12,12))
#fig.suptitle('Tapering and Spectral Leakage (N=8)',fontsize=16)
N=40
# 1st row
ax11.plot(np.linspace(0,N,2048),[1 for x in np.linspace(0,N,2048)])
ax11.vlines(x=0, ymin=0, ymax=1)
ax11.vlines(x=N, ymin=0, ymax=1)
ax11.set_title('Rectangular Window',size=16)
ax11.set_ylabel('Amplitude',size=14)
ax11.set_xlabel('Sample',size=14)
ax21.plot(np.linspace(0,N,2048),np.hanning(2048))
ax21.set_title('Hann Window',size=16)
ax21.set_ylabel('Amplitude',size=14)
ax21.set_xlabel('Sample',size=14)
# 2nd row
ax12.plot(np.linspace(-1/2,1/2,2048),Fejer(np.linspace(-1/2,1/2,2048),N=N)/N)
ax12.set_title("Féjer's Kernel",size=16)
ax12.set_xlim(-0.55,0.55)
ax12.xaxis.set_ticks(np.arange(-0.5, 0.6, 0.1))
ax12.set_ylabel('Normalised Magnitude',size=14)
ax12.set_xlabel('Frequency',size=14)
ax22.plot(np.linspace(-1/2,1/2,2048),Hanning(np.linspace(-1/2,1/2,2048),N=N)/np.max(Hanning(np.linspace(-1/2,1/2,2048),N=N)))
ax22.set_title("Hann Kernel",size=16)
ax22.set_xlim(-0.55,0.55)
ax22.xaxis.set_ticks(np.arange(-0.5, 0.6, 0.1))
ax22.set_ylabel('Normalised Magnitude',size=14)
ax22.set_xlabel('Frequency',size=14)
# 3rd row
ax13.plot(freq_response(N,window_type='boxcar')[0],freq_response(N,window_type='boxcar')[1])
ax13.set_title("Rectangular Frequency Response",size=16)
ax13.set_ylim(-80,5)
ax13.set_xlim(-0.55,0.55)
ax13.xaxis.set_ticks(np.arange(-0.5, 0.6, 0.1))
ax13.set_ylabel('Normalised Magnitude (dB)',size=14)
ax13.set_xlabel('Frequency',size=14)
ax23.plot(freq_response(N,window_type='hann')[0],freq_response(N,window_type='hann')[1])
ax23.set_title("Hann Frequency Response",size=16)
ax23.set_ylim(-120,5)
ax23.set_xlim(-0.55,0.55)
ax23.xaxis.set_ticks(np.arange(-0.5, 0.6, 0.1))
ax23.set_ylabel('Normalised Magnitude (dB)',size=14)
ax23.set_xlabel('Frequency',size=14)
plt.tight_layout(pad=1.5, h_pad=1.2, w_pad=1.2)
plt.savefig(figure_output_path + '/taper_examples_new.png')
garma_11012_model_path = '/Users/mateipapahagi/Desktop/M4R/M4R Code/GARMA_11012/'
summary_bic_loglik_garma_11012 = pd.read_csv(garma_11012_model_path + 'GARMA_11012_summary_bic_loglik_06.05.2022_22h50m.txt',header=None)
param_est_garma_11012=json.loads(summary_bic_loglik_garma_11012.iloc[0,1])
param_est_garma_11012
[0.10863468927814544, 0.8122956839050915, 0, 0.114696964073248, 0.21248810520350953, 0.2442261390509512, -0.30648799681219896, -0.8936501980907974, 0.38549974473443066, 0.4204388618493374, 1.765325300520516]
x_arma_1101 = ARMA_sim(Rp=1,Cp=1,
Rq=0,Cq=1,N=500,
alpha1R=[0.10863468927814544],
alpha1C=[0.8122956839050915],
omega1C=[0.114696964073248],
alpha2R=[],
alpha2C=[0.21248810520350953],
omega2C=[0.2442261390509512],
polynomial=True,table=True,
save=False,print=True)
| AR Coefficient | Value | |
|---|---|---|
| 1 | $\phi_0$ | 1 |
| 2 | $\phi_1$ | -1.329 |
| 3 | $\phi_2$ | 0.792 |
| 4 | $\phi_3$ | -0.072 |
| AR Polynomial | |
|---|---|
| Expression | $\Phi(z)=1-\phi_1z^1-\phi_2z^2-\phi_3z^3$ |
| Value | $\Phi(z)=1-1.329z^1+0.792z^2-0.072z^3$ |
| MA Coefficient | Value | |
|---|---|---|
| 1 | $\theta_0$ | 1 |
| 2 | $\theta_1$ | -0.015 |
| 3 | $\theta_2$ | 0.045 |
| MA Polynomial | |
|---|---|
| Expression | $\Theta(z)=1-\theta_1z^1-\theta_2z^2$ |
| Value | $\Theta(z)=1-0.015z^1+0.045z^2$ |